/* ============================================================
   SENTYX — trading terminal
   Graphite dashboard surface with an indigo accent, semantic P&L colour only.
   ============================================================ */

:root {
  /* Warm charcoal base, deliberately neutral so the two signal colours carry
     all the meaning. */
  --void:      #17171a;
  --panel:     #1e1e22;
  --raised:    #27272c;
  --hover:     #303036;
  --sunken:    #131316;

  --edge:      #37373e;
  --edge-soft: #2b2b31;

  /* The icon rail sits a shade darker than every other surface — the one
     visual constant behind whichever page is open. */
  --sidebar:       #0c0c0e;
  --sidebar-edge:  #020203;
  --sidebar-hover: #1c1c20;

  /* Body text is grey, NOT white. White is reserved as a signal colour, and it
     only reads as one if the surrounding text sits below it in brightness. */
  --text:      #c9c9ce;
  --text-hi:   #f4f4f6;
  --dim:       #8f8f96;
  --faint:     #65656c;

  /* The two signal colours. Indigo = long / profit, white = short / loss. */
  --up:        #7c7ff2;
  --up-bg:     rgba(124, 127, 242, 0.14);
  --up-line:   rgba(124, 127, 242, 0.42);
  --down:      #f2f5f7;
  --down-bg:   rgba(242, 245, 247, 0.10);
  --down-line: rgba(242, 245, 247, 0.34);
  --warn:      #9a9aa2;

  /* Interaction uses the same indigo as the brand accent, echoing the
     purple highlight used for active/selected states in the reference UI. */
  --accent:    #7c7ff2;
  --accent-bg: rgba(124, 127, 242, 0.12);

  /* Economic-calendar impact tiers. A separate, conventional red/amber/yellow
     scale — deliberately outside the up/down P&L semantics above, since impact
     severity and trade direction are unrelated axes of meaning. */
  --impact-high:      #e5484d;
  --impact-high-bg:   rgba(229, 72, 77, 0.16);
  --impact-medium:    #f5a623;
  --impact-medium-bg: rgba(245, 166, 35, 0.16);
  --impact-low:       #e8d44d;
  --impact-low-bg:    rgba(232, 212, 77, 0.14);

  --r-xs: 5px;
  --r-sm: 7px;
  --r-md: 11px;
  --r-lg: 15px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .55);
  --shadow-md: 0 6px 16px -4px rgba(0, 0, 0, .65);
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .8);

  --pad: 11px;
  --gap: 11px;

  --z-noise: 100;
  --z-header: 200;
  --z-modal: 400;
  --z-toast: 500;

  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --fast: 150ms var(--ease);
  --med: 240ms var(--ease);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--void);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* every figure in this UI is compared column-to-column */
  font-variant-numeric: tabular-nums;
}

/* Grain breaks the flatness of large dark panels. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: var(--z-noise);
  pointer-events: none;
  opacity: .022;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3, p { margin: 0; }

h2 {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
}

.hint { font-size: 10.5px; color: var(--faint); letter-spacing: .02em; }
.is-hidden { display: none !important; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--faint); }
.spacer { flex: 1; }

::selection { background: var(--accent-bg); color: var(--text); }

/* One focus treatment for the entire app. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: var(--z-toast);
  background: var(--raised);
  color: var(--text);
  border: 1px solid var(--edge);
  border-radius: var(--r-sm);
  padding: 9px 14px;
  font-size: 12px;
  text-decoration: none;
  transition: top var(--fast);
}
.skip-link:focus { top: 12px; }

/* ------------------------------------------------------------- shell */

/* Icon-only rail on the left, everything else lives on its own page to the
   right — no more one screen trying to hold the whole app at once. */
.app {
  display: flex;
  height: 100dvh;
  background: var(--sidebar);
}

.sidebar {
  width: 68px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 0 18px;
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-edge);
}

.side-logo {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 14px;
  border-radius: var(--r-md);
  flex-shrink: 0;
}
.side-logo img {
  width: 20px;
  height: 19px;
  /* Source art is black on transparent. brightness(0) flattens every opaque
     pixel to black, invert(1) then lifts it to white, alpha untouched. */
  filter: brightness(0) invert(1);
  opacity: .92;
}

.side-nav { display: flex; flex-direction: column; gap: 2px; }

.side-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: none;
  border: 0;
  border-radius: var(--r-md);
  color: var(--faint);
  cursor: pointer;
  transition: color var(--fast), background var(--fast);
}
.side-btn .ph { font-size: 18px; line-height: 1; }
.side-btn:hover { color: var(--text); background: var(--sidebar-hover); }
.side-btn.is-active { color: var(--text-hi); background: var(--sidebar-hover); }
.side-btn.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.side-spacer { flex: 1; }

.side-add {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-top: 8px;
  background: var(--text-hi);
  border: 0;
  border-radius: 50%;
  color: var(--void);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform var(--fast), box-shadow var(--fast);
}
.side-add .ph { font-size: 17px; line-height: 1; }
.side-add:hover { transform: scale(1.06); }
.side-add:active { transform: scale(.97); }

.shell {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: var(--void);
  border-radius: 18px 0 0 0;
  overflow: hidden;
}

/* ---------------------------------------------------------- top bar */

.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 56px;
  padding: 0 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--edge-soft);
}

.acct-block { display: flex; flex-direction: column; gap: 1px; }
.acct-lbl {
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--faint);
}
.acct-val {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.02em;
}
.acct-muted { color: var(--dim); font-weight: 500; }

.acct-progress { flex: 1; min-width: 110px; max-width: 440px; }
.acct-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 10px;
  color: var(--faint);
  margin-bottom: 6px;
}
.goal-bar {
  height: 6px;
  background: var(--sunken);
  border: 1px solid var(--edge-soft);
  border-radius: 99px;
  overflow: hidden;
}
.goal-fill {
  height: 100%;
  min-width: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg, #413fae, var(--up));
  transition: width 600ms var(--ease);
}

.timeframes {
  display: flex;
  gap: 2px;
  background: var(--sunken);
  padding: 3px;
  border-radius: var(--r-md);
  border: 1px solid var(--edge-soft);
}
.tf-btn {
  background: none;
  border: 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 9px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color var(--fast), background var(--fast);
}
.tf-btn:hover { color: var(--text); background: var(--hover); }
.tf-btn:active { transform: translateY(.5px); }
.tf-btn.is-active {
  background: var(--raised);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--faint);
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); }
.dot.is-live { background: var(--up); box-shadow: 0 0 0 3px var(--up-bg); }
.dot.is-error { background: var(--text-hi); box-shadow: 0 0 0 3px var(--down-bg); }
.clock { font-family: var(--mono); font-size: 12px; color: var(--dim); }

/* icon buttons */
.icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--faint);
  cursor: pointer;
  transition: color var(--fast), background var(--fast), border-color var(--fast);
}
.icon-btn:hover { color: var(--text); background: var(--hover); border-color: var(--edge); }
.icon-btn:active { transform: translateY(.5px); }
.icon-btn .ph { font-size: 16px; line-height: 1; }
.icon-btn-sm { width: 24px; height: 24px; }
.icon-btn-sm .ph { font-size: 14px; }

/* ------------------------------------------------------------- pages */

main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.page {
  display: none;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  padding: var(--pad) 24px;
}
.page.is-active { display: flex; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-shrink: 0;
  padding: 14px 0 18px;
}
.page-head h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.15;
}
.page-sub { margin-top: 5px; font-size: 12px; color: var(--faint); }
.page-actions { display: flex; align-items: flex-start; gap: 10px; flex-shrink: 0; }

.page-body { flex: 1; min-height: 0; overflow-y: auto; }

/* Signals page: a master list beside its own detail, not a stacked grid
   sitting above a separate chart page — one selection, one view. */
.signals-split {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  height: 100%;
  min-height: 0;
}
.signals-list {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-right: 2px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.detail-panel {
  flex: 1;
  min-height: 0;
  container-type: inline-size;
  container-name: detail;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  /* optical: a touch less below than above, the border adds visual weight */
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--edge-soft);
  flex-shrink: 0;
}

/* ---------------------------------------------------- signal list */

.scan-filter {
  display: flex;
  flex-wrap: wrap; /* the panel is user-resizable down to 200px */
  gap: 5px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--edge-soft);
}
.chip {
  background: var(--sunken);
  border: 1px solid var(--edge-soft);
  color: var(--faint);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 500;
  padding: 4px 11px;
  border-radius: var(--r-xs);
  cursor: pointer;
  transition: color var(--fast), background var(--fast), border-color var(--fast);
}
.chip:hover { color: var(--text); border-color: var(--edge); }
.chip:active { transform: translateY(.5px); }
.chip.is-active {
  background: var(--accent-bg);
  border-color: var(--faint);
  color: var(--text-hi);
  font-weight: 600;
}

.sig-tag {
  justify-self: start;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .1em;
  padding: 2px 6px;
  border-radius: var(--r-xs);
}
.tag-LONG { color: var(--up); background: var(--up-bg); }
.tag-SHORT { color: var(--down); background: var(--down-bg); }
.tag-NEUTRAL { color: var(--faint); background: var(--hover); }

/* -------------------------------------------------------- signal list */

.sig-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 5px;
  padding: 9px 11px;
  background: var(--panel);
  border: 1px solid var(--edge-soft);
  border-left: 2px solid var(--accent-line, var(--edge));
  border-radius: var(--r-sm);
  text-align: left;
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast);
  animation: rise 260ms var(--ease) backwards;
  animation-delay: calc(var(--i, 0) * 10ms);
  flex-shrink: 0;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.sig-row:hover { background: var(--raised); border-color: var(--edge); }
.sig-row.is-active { background: var(--raised); border-color: var(--accent); }
.sig-row:active { transform: translateY(.5px); }

.sig-row-id { grid-column: 1; grid-row: 1; display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.sig-row-sym { font-family: var(--mono); font-size: 12.5px; font-weight: 600; letter-spacing: -.01em; }
.sig-row-name { font-size: 10px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sig-row-score { grid-column: 2; grid-row: 1; font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: -.01em; }

.sig-row-mid { grid-column: 1; grid-row: 2; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; min-width: 0; }

.sig-row-price { grid-column: 2; grid-row: 2; display: flex; align-items: baseline; gap: 6px; justify-self: end; }
.sig-row-px { font-family: var(--mono); font-size: 11px; color: var(--text); }
.sig-row-chg { font-family: var(--mono); font-size: 10px; }

/* -------------------------------------------------------- detail */

.detail {
  overflow-y: auto;
  padding: 22px 24px 26px;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  column-gap: 26px;
  align-content: start;
}
#detailHead { grid-column: 1 / -1; }
#detailLeft { grid-column: 1; grid-row: 2 / span 2; min-width: 0; }
#mini { grid-column: 2; grid-row: 2; min-width: 0; }
#detailRight { grid-column: 2; grid-row: 3; min-width: 0; }

.d-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--edge-soft);
}
.d-sym {
  font-family: var(--mono);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -.035em;
  line-height: 1;
}
.d-name { font-size: 12px; color: var(--faint); margin-top: 6px; }
.d-price {
  font-family: var(--mono);
  font-size: 27px;
  font-weight: 500;
  letter-spacing: -.03em;
  text-align: right;
  line-height: 1;
}
.d-chg { font-family: var(--mono); font-size: 12px; text-align: right; margin-top: 6px; }

.d-strip { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }

.d-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 11px;
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: .08em;
  padding: 9px 18px;
  border-radius: var(--r-md);
  border: 1px solid;
}
.d-badge small { font-family: var(--sans); font-size: 11px; font-weight: 500; letter-spacing: 0; opacity: .75; }
.d-LONG { color: var(--up); border-color: var(--up-line); background: var(--up-bg); }
.d-SHORT { color: var(--down); border-color: var(--down-line); background: var(--down-bg); }
.d-NEUTRAL { color: var(--dim); border-color: var(--edge); background: var(--raised); }

/* status pill — is this setup still takeable? */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 99px;
  border: 1px solid;
}
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-wait { color: var(--dim); border-color: var(--edge); background: var(--raised); }
.st-live { color: var(--text); border-color: var(--edge); background: var(--hover); }
.st-done { color: var(--accent); border-color: var(--edge); background: var(--accent-bg); }
.st-dead { color: var(--text-hi); border-color: var(--down-line); background: var(--down-bg); }

/* ------------------------------------------------------ mini chart */

.mini { margin-bottom: 22px; }
.mini-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.mini-title { font-size: 10px; text-transform: uppercase; letter-spacing: .11em; color: var(--faint); }
.mini-legend { display: flex; align-items: center; gap: 7px; font-size: 10px; color: var(--faint); }
.key { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.key-sl { background: rgba(242,245,247,.4); border: 1px solid var(--down-line); }
.key-tp { background: rgba(124,127,242,.45); border: 1px solid var(--up-line); }
.key-entry { background: var(--accent); height: 2px; border-radius: 0; }

.mini-wrap {
  position: relative;
  height: 214px;
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--sunken);
}
#miniChart { position: absolute; inset: 0; }

/* lightweight-charts stacks its canvases at z-index 1–2 and its attribution
   link at 3; a z-index:auto sibling paints underneath them all. */
.zones { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 4; }
.zone {
  position: absolute;
  display: flex;
  align-items: center;
  padding-left: 7px;
  border-radius: 2px;
  min-height: 1px;
}
.zone-sl { background: rgba(242,245,247,.16); border: 1px solid rgba(242,245,247,.7); }
.zone-tp { background: rgba(124,127,242,.24); border: 1px solid rgba(124,127,242,.65); }
.zone-tp.tp2 { background: rgba(124,127,242,.15); }
.zone-tp.tp3 { background: rgba(124,127,242,.09); }
.zone-line {
  position: absolute;
  height: 0;
  border-top: 1px dashed var(--accent);
  display: flex;
  align-items: center;
}
.zone-tag {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
  background: rgba(6, 7, 8, .84);
}
.zone-sl .zone-tag { color: var(--text-hi); }
.zone-tp .zone-tag { color: #b2b4f7; }
.zone-line .zone-tag { color: var(--accent); transform: translateY(-50%); margin-left: 5px; }

/* --------------------------------------------- entry → TP1 track */

.track {
  padding: 13px 15px;
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-md);
  background: var(--raised);
  margin-bottom: 14px;
}
.track-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
  margin-bottom: 8px;
}
.track-bar {
  position: relative;
  height: 6px;
  background: var(--sunken);
  border-radius: 99px;
  overflow: visible;
}
.track-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #413fae, var(--up));
  transition: width var(--med);
}
/* the 'you are here' marker must outrank both signal colours */
.track-now {
  position: absolute;
  top: 50%;
  width: 3px;
  height: 14px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--text-hi);
  transform: translateY(-50%);
  box-shadow: 0 0 0 2px var(--raised);
  transition: left var(--med);
}
.track-note { margin-top: 10px; font-size: 11px; color: var(--dim); line-height: 1.55; text-wrap: pretty; }

.d-cols { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 26px; align-items: start; }

/* price ladder */
.ladder { display: flex; flex-direction: column; gap: 5px; margin-bottom: 20px; }
.rung {
  display: grid;
  grid-template-columns: 54px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--edge-soft);
  background: var(--raised);
  transition: border-color var(--fast);
}
.rung:hover { border-color: var(--edge); }
.rung-lbl { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .1em; }
.rung-note { font-size: 11px; color: var(--faint); }
.rung-meta { font-family: var(--mono); font-size: 10.5px; color: var(--faint); text-align: right; min-width: 92px; }
.rung-price { font-family: var(--mono); font-size: 20px; font-weight: 600; letter-spacing: -.03em; text-align: right; }

.rung-entry { border-color: var(--edge); background: var(--accent-bg); }
.rung-entry .rung-lbl, .rung-entry .rung-price { color: var(--accent); }
.rung-sl { border-color: var(--down-line); background: var(--down-bg); }
.rung-sl .rung-lbl, .rung-sl .rung-price { color: var(--down); }
.rung-tp { border-color: var(--up-line); background: var(--up-bg); }
.rung-tp .rung-lbl, .rung-tp .rung-price { color: var(--up); }
.rung-tp.tp2 { background: rgba(124,127,242,.09); border-color: rgba(124,127,242,.28); }
.rung-tp.tp3 { background: rgba(124,127,242,.05); border-color: rgba(124,127,242,.18); }

.d-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 6px; margin-bottom: 22px; }
.d-cell { background: var(--raised); border-radius: var(--r-sm); padding: 10px 12px; }
.d-cell span {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .11em;
  color: var(--faint);
  margin-bottom: 4px;
}
.d-cell b { font-family: var(--mono); font-size: 14px; font-weight: 600; letter-spacing: -.02em; }

.d-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--dim);
  margin: 0 0 12px;
}

.reason {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 13px;
  padding: 10px 0;
  border-bottom: 1px solid var(--edge-soft);
}
.reason:last-child { border-bottom: 0; }
.reason-pts { font-family: var(--mono); font-size: 12px; font-weight: 600; text-align: right; }
.reason-lbl { display: block; font-size: 12px; font-weight: 500; }
.reason-detail { display: block; font-size: 11px; color: var(--faint); line-height: 1.55; margin-top: 2px; text-wrap: pretty; }

.no-trade {
  padding: 22px 24px;
  border-radius: var(--r-md);
  background: var(--raised);
  border: 1px solid var(--edge-soft);
  margin-bottom: 22px;
}
.no-trade b { display: block; font-size: 13px; margin-bottom: 6px; }
.no-trade p { margin: 0; font-size: 12px; color: var(--faint); line-height: 1.65; max-width: 58ch; text-wrap: pretty; }

/* ------------------------------------------------------ calendar */

.cal-nav { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--dim); }
#monthLabel { min-width: 82px; text-align: center; font-family: var(--mono); }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; padding: 11px; }
.cal-dow {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--faint);
  text-align: center;
  padding-bottom: 4px;
}

.cal-cell {
  aspect-ratio: 1 / .84;
  border-radius: var(--r-xs);
  background: var(--raised);
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 2px;
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast), transform var(--fast);
}
.cal-cell:hover { border-color: var(--accent); transform: translateY(-1px); }
.cal-cell:active { transform: none; }
.cal-blank { visibility: hidden; }
.cal-cell.is-today { border-color: var(--dim); }
.cal-cell.is-today .cal-day { color: var(--text); font-weight: 600; }
.cal-day { font-family: var(--mono); font-size: 10px; color: var(--faint); }
.cal-pnl { font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: -.02em; }
.cal-cell.is-win { background: rgba(124,127,242,.20); }
.cal-cell.is-win .cal-day { color: #b2b4f7; }
.cal-cell.is-loss { background: rgba(242,245,247,.13); }
.cal-cell.is-loss .cal-day { color: var(--text-hi); }
.cal-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }

.month-total {
  padding: 10px 14px;
  border-top: 1px solid var(--edge-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.month-total span {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--faint);
}
.month-total b { font-family: var(--mono); font-size: 13px; font-weight: 600; }

/* --------------------------------------------------------- stats */

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--edge-soft); }
.stat { background: var(--panel); padding: 11px 14px; }
.stat span {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .11em;
  color: var(--faint);
  margin-bottom: 4px;
}
.stat b { font-family: var(--mono); font-size: 14px; font-weight: 600; letter-spacing: -.02em; }

/* empty state */
.empty-state { padding: 26px 22px; text-align: center; }
.empty-state .ph { display: block; font-size: 28px; color: var(--faint); margin-bottom: 12px; line-height: 1; }
.empty-state b { display: block; font-size: 12.5px; font-weight: 500; margin-bottom: 5px; }
.empty-state p { margin: 0 auto; font-size: 11.5px; color: var(--faint); line-height: 1.6; max-width: 30ch; text-wrap: pretty; }

/* skeletons */
.skeleton { padding: 11px 14px; border-bottom: 1px solid var(--edge-soft); }
.sk-line {
  height: 9px;
  border-radius: var(--r-xs);
  background: linear-gradient(90deg, var(--raised) 25%, var(--hover) 50%, var(--raised) 75%);
  background-size: 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  margin-bottom: 7px;
}
.sk-line:last-child { margin-bottom: 0; }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -150% 0; } }

/* ---------------------------------------------------------- feed */

.tabs-head { padding: 7px 12px; }
.tabs { display: flex; gap: 3px; }
.tab {
  background: none;
  border: 0;
  color: var(--faint);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color var(--fast), background var(--fast);
}
.tab:hover { color: var(--dim); background: var(--raised); }
.tab.is-active { background: var(--raised); color: var(--text); font-weight: 600; }

.feed { overflow-y: auto; flex: 1; padding: 3px 0; }

.news-item {
  display: grid;
  grid-template-columns: 66px 1fr;
  gap: 13px;
  padding: 9px 15px;
  border-bottom: 1px solid var(--edge-soft);
  text-decoration: none;
  color: inherit;
  transition: background var(--fast);
}
.news-item:hover { background: var(--raised); }
.news-time { font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.news-title { display: block; font-size: 12px; line-height: 1.45; text-wrap: pretty; }
.news-meta { display: block; font-size: 10px; color: var(--faint); margin-top: 3px; }
.news-src { color: var(--dim); }

.ec-item {
  display: grid;
  grid-template-columns: 58px 34px 54px 1fr repeat(3, 62px);
  gap: 9px;
  align-items: center;
  padding: 8px 15px;
  border-bottom: 1px solid var(--edge-soft);
  font-size: 11.5px;
}
.ec-item.is-past { opacity: .42; }
.ec-item.is-next { background: var(--raised); box-shadow: inset 2px 0 0 var(--text-hi); }
.ec-time { font-family: var(--mono); font-size: 10.5px; color: var(--faint); }
.ec-ccy { font-family: var(--mono); font-weight: 600; font-size: 11px; }

/* Coloured severity box, ForexFactory-style, in place of a bare dot — the
   colour has to be readable at a glance without hovering for a title. */
.ec-impact-badge {
  justify-self: start;
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 2px 6px;
  border-radius: var(--r-xs);
  border: 1px solid transparent;
  white-space: nowrap;
}
.eib-High   { color: var(--impact-high);   background: var(--impact-high-bg);   border-color: rgba(229, 72, 77, .38); }
.eib-Medium { color: var(--impact-medium); background: var(--impact-medium-bg); border-color: rgba(245, 166, 35, .38); }
.eib-Low    { color: var(--impact-low);    background: var(--impact-low-bg);    border-color: rgba(232, 212, 77, .32); }
.eib-Holiday, .eib-Non-Economic { color: var(--faint); background: var(--hover); }

.ec-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Actual / forecast / previous as small boxed cells — reads as a table of
   figures rather than three loose numbers trailing off the row. */
.ec-fig {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  padding: 3px 7px;
  border-radius: var(--r-xs);
  background: var(--sunken);
  border: 1px solid var(--edge-soft);
}
.ec-fig span {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--faint);
}
.ec-fig b { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--dim); }
.ec-fig.ec-actual { background: var(--raised); border-color: var(--edge); }
.ec-fig.ec-actual b { color: var(--text); }
.ec-fig.ec-actual b.up { color: var(--up); }
.ec-fig.ec-actual b.down { color: var(--down); }
.ec-day {
  padding: 9px 15px 5px;
  font-size: 9px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--faint);
  background: var(--panel);
  position: sticky;
  top: 0;
}

/* ------------------------------------------------------ signal history */

.hist-summary {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--edge-soft);
  position: sticky;
  top: 0;
  z-index: 1;
}
.hist-stat {
  background: var(--panel);
  padding: 11px 13px;
  border: 0;
  border-bottom: 2px solid transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast);
}
.hist-stat:not([disabled]):hover { background: var(--raised); }
.hist-stat.is-active { background: var(--accent-bg); border-bottom-color: var(--accent); }
.hist-stat[disabled] { cursor: default; }
.hist-stat span {
  display: block;
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--faint);
  margin-bottom: 3px;
}
.hist-stat b { font-family: var(--mono); font-size: 15px; font-weight: 600; }

.hist-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 10px 16px;
  align-items: center;
  width: 100%;
  padding: 10px 18px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--edge-soft);
  font: inherit;
  font-size: 12px;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--fast);
}
.hist-item:hover { background: var(--raised); }
.hist-item.is-expanded { background: var(--raised); }
.hist-lead { display: flex; align-items: center; gap: 9px; min-width: 0; }
.hist-caret { font-size: 10px; color: var(--faint); flex-shrink: 0; transition: transform var(--fast); }
.is-expanded .hist-caret { transform: rotate(90deg); color: var(--dim); }
.hist-sym { font-family: var(--mono); font-weight: 600; font-size: 12.5px; letter-spacing: -.01em; }
.hist-entry { font-family: var(--mono); font-size: 11px; color: var(--faint); white-space: nowrap; }

/* Reasoning captured at entry time, and the plain-English verdict — the
   part that turns a list of outcomes into something to actually learn from. */
.hist-reasons {
  padding: 6px 18px 16px 41px;
  border-bottom: 1px solid var(--edge-soft);
  background: var(--sunken);
}
.hist-reasons .reason { padding: 8px 0; border-bottom: 1px solid var(--edge-soft); }
.hist-reasons .reason:last-of-type { border-bottom: 0; }
.hist-no-reasons { margin: 8px 0; font-size: 11.5px; color: var(--faint); }
.hist-outcome { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--edge-soft); font-size: 11.5px; color: var(--dim); line-height: 1.5; }

.hist-insights {
  padding: 14px 18px;
  border-bottom: 1px solid var(--edge-soft);
  background: var(--raised);
}
.hist-insights-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--dim);
  margin-bottom: 10px;
}
.hist-insights-head .ph { font-size: 14px; color: var(--faint); }
.hist-insight {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
  padding: 8px 0;
  border-top: 1px solid var(--edge-soft);
}
.hist-insight:first-of-type { border-top: 0; padding-top: 0; }
.hist-insight b { font-size: 12px; font-weight: 600; }
.hist-insight span { font-size: 11px; color: var(--faint); }

/* Adaptive weighting: live feedback that a factor's vote has actually been
   turned up or down from what closed trades have earned it. */
.hist-learning { padding: 14px 18px; border-bottom: 1px solid var(--edge-soft); background: var(--raised); }
.learn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.learn-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 8px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--panel);
  border: 1px solid var(--edge-soft);
}
.learn-label { font-size: 11.5px; font-weight: 600; flex: 1 1 auto; min-width: 0; }
.learn-meta { flex: 1 1 100%; font-size: 10px; color: var(--faint); }

.learn-badge {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--r-xs);
  color: var(--faint);
  background: var(--sunken);
  border: 1px solid var(--edge-soft);
  white-space: nowrap;
}
.learn-badge.up { color: var(--up); background: var(--up-bg); border-color: var(--up-line); }
.learn-badge.down { color: var(--down); background: var(--down-bg); border-color: var(--down-line); }

/* Same badge, inline in a reason label wherever reasoning is shown live. */
.reason-lbl .learn-badge { margin-left: 6px; font-size: 9px; padding: 1px 5px; vertical-align: 1px; }

.hist-dots { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.hdot {
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 2px 6px;
  border-radius: var(--r-xs);
  color: var(--faint);
  background: var(--sunken);
  border: 1px solid var(--edge-soft);
}
.hdot.is-hit { color: var(--up); background: var(--up-bg); border-color: var(--up-line); }
.hdot-sl.is-hit { color: var(--down); background: var(--down-bg); border-color: var(--down-line); }

.hist-status {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 4px 9px;
  border-radius: var(--r-xs);
  white-space: nowrap;
  justify-self: end;
}
.hs-win  { color: var(--up); background: var(--up-bg); }
.hs-loss { color: var(--down); background: var(--down-bg); }
.hs-live { color: var(--text); background: var(--hover); }

.hist-time { font-family: var(--mono); font-size: 10.5px; color: var(--faint); text-align: right; white-space: nowrap; }

@media (max-width: 720px) {
  .hist-summary { grid-template-columns: repeat(4, 1fr); }
  .hist-item { grid-template-columns: minmax(0, 1fr) auto auto; }
  .hist-time { display: none; }
}

/* --------------------------------------------------------- modal */

.modal-back {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(4, 5, 6, .78);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fade 180ms var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 356px;
  max-width: 100%;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 22px;
  background: var(--panel);
  /* 1px inner highlight simulates a lit top edge */
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, .04);
  animation: pop 240ms var(--ease);
}
@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.modal h3 { font-size: 15px; font-weight: 600; letter-spacing: -.015em; }
.modal-sub { margin: 5px 0 18px; font-size: 11.5px; color: var(--faint); line-height: 1.55; text-wrap: pretty; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 9.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .11em;
  color: var(--faint);
  margin-bottom: 6px;
}
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--sunken);
  border: 1px solid var(--edge);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  padding: 9px 11px;
  transition: border-color var(--fast), background var(--fast);
}
.field textarea { font-family: var(--sans); font-size: 12px; resize: vertical; line-height: 1.5; }
.field select { font-family: var(--sans); cursor: pointer; }
.field input:hover, .field textarea:hover, .field select:hover { border-color: var(--faint); }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--void);
}
.field input.has-error, .field input.has-error:focus { border-color: var(--down); }

.input-wrap { position: relative; }
.input-prefix {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--faint);
  pointer-events: none;
}
.input-wrap input { padding-left: 26px; }

.field-error { margin: 6px 0 0; font-size: 11px; color: var(--text-hi); }

.modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 20px; }

.btn {
  border-radius: var(--r-sm);
  padding: 9px 15px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--fast), color var(--fast), border-color var(--fast), transform var(--fast);
}
.btn:active { transform: translateY(1px); }
.btn-quiet { background: none; color: var(--dim); border-color: var(--edge); }
.btn-quiet:hover { background: var(--raised); color: var(--text); }
.btn-danger { border-color: transparent; color: var(--faint); }
.btn-danger:hover { background: var(--down-bg); color: var(--down); border-color: var(--down-line); }
.btn-primary { background: var(--up); color: #0e0e1f; font-weight: 600; }
.btn-primary:hover { background: #9a9cf5; }

/* -------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 46px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 210px;
  max-width: 320px;
  padding: 11px 14px;
  background: var(--raised);
  border: 1px solid var(--edge);
  border-left: 2px solid var(--dim);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  font-size: 12px;
  animation: slideIn 280ms var(--ease);
}
.toast.is-leaving { animation: slideOut 220ms var(--ease) forwards; }
.toast-ok { border-left-color: var(--up); }
.toast-err { border-left-color: var(--text-hi); }
@keyframes slideIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes slideOut { to { opacity: 0; transform: translateX(14px); } }

/* ------------------------------------------------------- footer */

.disclaimer {
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 22px;
  border-top: 1px solid var(--edge-soft);
  background: var(--panel);
}
.disclaimer p { margin: 0; font-size: 10px; color: var(--faint); line-height: 1.35; }

/* --------------------------------------------------- scrollbars */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--hover);
  border-radius: 99px;
  border: 3px solid var(--panel);
}
::-webkit-scrollbar-thumb:hover { background: #2c3034; }

/* -------------------------------------------------- responsive */

@media (max-width: 1500px) { .acct-progress { max-width: 230px; } }

@media (max-width: 1000px) { .acct-net { display: none; } }

/* The detail column is only as wide as the page allows, not the viewport —
   this keeps the chart/ladder layout correct however the window is sized. */
@container detail (max-width: 760px) {
  .d-cols { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .detail { grid-template-columns: minmax(0, 1fr); }
  #detailHead, #detailLeft, #mini, #detailRight { grid-column: 1; grid-row: auto; }
}

@container detail (max-width: 520px) {
  .detail { padding: 18px 16px 20px; }
  .d-sym { font-size: 26px; }
  .d-price { font-size: 22px; }
  /* Drop the prose column first; the number is what must never clip. */
  .rung { grid-template-columns: 46px 1fr auto; gap: 10px; padding: 11px 13px; }
  .rung-note { display: none; }
  .rung-price { font-size: 18px; }
  .rung-meta { min-width: 0; }
  .size-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .d-grid { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
}

@container detail (max-width: 380px) {
  .d-head { flex-direction: column; gap: 10px; }
  .d-price, .d-chg { text-align: left; }
  .rung-meta { display: none; }
}

@media (max-width: 1100px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px 16px; }
  .page { padding: var(--pad) 16px; }
  .journal-body { grid-template-columns: minmax(0, 1fr); }
  .ec-item { grid-template-columns: 56px 30px 50px 1fr; }
  .ec-item .ec-fig { display: none; }
}

@media (max-width: 640px) {
  .sidebar { width: 56px; }
  .side-btn { width: 34px; height: 34px; }
  .side-add { width: 32px; height: 32px; }
}

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

/* ------------------------------------------------ trader alerts */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--r-md);
  border: 1px solid;
  font-size: 11.5px;
  line-height: 1.5;
  margin-bottom: 10px;
  text-wrap: pretty;
}
.alert .ph { font-size: 15px; line-height: 1.3; flex-shrink: 0; }
.alert-stop { color: var(--text-hi); border-color: var(--down-line); background: var(--down-bg); }
.alert-warn { color: var(--dim); border-color: var(--edge); background: var(--raised); }
.alert-info { color: #b2b4f7; border-color: var(--up-line); background: var(--up-bg); }

/* ---------------------------------------------- position sizing */

.size {
  padding: 13px 15px;
  border: 1px solid var(--edge-soft);
  border-radius: var(--r-md);
  background: var(--raised);
  margin-bottom: 14px;
}
.size-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
}
.size-head > span:first-child {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .11em;
  color: var(--faint);
}
.size-risk { font-family: var(--mono); font-size: 10.5px; color: var(--dim); }

.size-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.size-cell span {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--faint);
  margin-bottom: 3px;
}
.size-cell b {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.02em;
}
.size-note { margin-top: 10px; font-size: 11px; color: var(--text-hi); line-height: 1.5; }

@media (max-width: 620px) { .size-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* row-level setup state, so the scanner answers "is this still takeable?" */
.sig-row2 { display: flex; align-items: center; gap: 5px; min-width: 0; }
.sig-state {
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 2px 5px;
  border-radius: var(--r-xs);
  border: 1px solid transparent;
}
.rs-live { color: var(--text); background: var(--hover); }
.rs-wait { color: var(--faint); background: var(--raised); }
.rs-done { color: var(--faint); background: var(--raised); }
.rs-dead { color: var(--text-hi); background: var(--down-bg); }
.rs-cost { color: var(--text-hi); background: transparent; border-color: var(--down-line); }


/* ------------------------------------------------------ journal page */

.journal-body {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
  padding-bottom: 20px;
}
.journal-body .panel { max-height: 100%; }

.goal-block { display: flex; align-items: center; gap: 20px; }

/* ------------------------------------------- inline account editing */

button.acct-block {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 4px 8px;
  margin: -4px -8px;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast);
}
button.acct-block:hover { background: var(--raised); border-color: var(--edge); }
button.acct-block:active { transform: translateY(.5px); }

.acct-lbl .ph {
  font-size: 10px;
  opacity: 0;
  margin-left: 2px;
  transition: opacity var(--fast);
}
button.acct-block:hover .ph, button.acct-block:focus-visible .ph { opacity: .75; }

.acct-input {
  width: 8ch;
  background: var(--sunken);
  border: 1px solid var(--up);
  border-radius: var(--r-xs);
  color: var(--text-hi);
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.02em;
  padding: 0 4px;
}
.acct-input:focus { outline: none; }

/* ----------------------------------------------------------- login gate */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  background: var(--void);
  padding: 20px;
}
.login-card {
  width: 320px;
  max-width: 100%;
  padding: 28px 26px 24px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, .04);
  text-align: center;
}
.login-logo { display: block; margin: 0 auto 14px; border-radius: 6px; }
.login-card h1 { font-size: 17px; font-weight: 600; letter-spacing: -.02em; color: var(--text-hi); }
.login-sub { margin: 4px 0 22px; font-size: 12px; color: var(--faint); }
.login-field { display: block; text-align: left; margin-bottom: 14px; }
.login-field span {
  display: block;
  font-size: 9.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .11em;
  color: var(--faint);
  margin-bottom: 6px;
}
.login-field input {
  width: 100%;
  background: var(--sunken);
  border: 1px solid var(--edge);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  padding: 9px 11px;
  transition: border-color var(--fast), background var(--fast);
}
.login-field input:hover { border-color: var(--faint); }
.login-field input:focus {
  outline: none;
  border-color: var(--up);
  background: var(--void);
}
.login-error {
  margin: -4px 0 14px;
  font-size: 11.5px;
  color: var(--down);
  text-align: left;
}
.login-submit {
  width: 100%;
  padding: 10px;
  background: var(--up);
  color: #0e0e1f;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--fast);
}
.login-submit:hover { background: #9a9cf5; }
.login-submit:disabled { opacity: .6; cursor: default; }

/* ----------------------------------------------------------- overview */

.ov-body { display: flex; flex-direction: column; gap: 18px; }

.ov-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.ov-stat {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 15px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.ov-stat .ph { font-size: 19px; color: var(--faint); flex-shrink: 0; }
.ov-stat b { display: block; font-family: var(--mono); font-size: 19px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.ov-stat span { display: block; font-size: 10.5px; color: var(--faint); margin-top: 2px; }

.ov-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ov-panel { min-height: 0; }
.ov-panel .panel-head h2 { display: flex; align-items: center; gap: 6px; }
.ov-panel .panel-head h2 .ph { font-size: 12px; }

.ov-chart-wrap { padding: 18px 16px; min-height: 200px; display: flex; flex-direction: column; justify-content: center; }

.ov-bar-row { display: grid; grid-template-columns: 96px 1fr 28px; align-items: center; gap: 10px; padding: 7px 0; }
.ov-bar-label { font-size: 11px; color: var(--faint); }
.ov-bar-track { height: 8px; background: var(--sunken); border-radius: 99px; overflow: hidden; }
.ov-bar-fill { height: 100%; border-radius: 99px; transition: width var(--med); }
.ov-bar-value { font-family: var(--mono); font-size: 11.5px; text-align: right; }

.ov-equity-svg { width: 100%; height: 150px; display: block; }
.ov-zero-line { stroke: var(--edge); stroke-width: 1; stroke-dasharray: 3 3; }
.ov-equity-foot { display: flex; justify-content: space-between; margin-top: 10px; font-size: 11px; color: var(--faint); }
.ov-equity-foot span:last-child { font-family: var(--mono); font-weight: 600; }

/* validation strip: does trusting a factor more actually win more? */
.ov-validate {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 14px 16px;
  border-bottom: 1px solid var(--edge-soft);
}
.ov-val-cell { display: flex; flex-direction: column; gap: 3px; padding: 0 16px; border-left: 1px solid var(--edge-soft); }
.ov-val-cell:first-child { border-left: none; padding-left: 0; }
.ov-val-label { font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; }
.ov-val-cell b { font-family: var(--mono); font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.ov-val-meta { font-size: 10.5px; color: var(--faint); }
.ov-val-hint { font-size: 10px; color: var(--faint); opacity: .75; }
.ov-val-empty { display: block; font-size: 12px; color: var(--faint); margin-top: 3px; }

/* the "brain": a node-link graph, Obsidian's graph view is the reference —
   a central AI hub wired to every factor, dimmer peer links between
   factors that tend to fire together, subtle staggered pulse per node. */
.ov-learn-body { display: grid; grid-template-columns: 280px 1fr; gap: 30px; align-items: center; padding: 16px; }
.ov-graph-wrap { display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ov-graph-svg { width: 100%; max-width: 280px; height: auto; }

.ov-graph-peer { stroke: var(--faint); stroke-width: 1; }
.ov-graph-spoke { stroke: var(--up); stroke-width: 1; }

.ov-graph-hub { fill: var(--raised); stroke: var(--text-hi); stroke-width: 1.4; }
.ov-graph-hub-glow { fill: var(--up); opacity: .16; animation: ov-pulse 3.2s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
.ov-graph-hub-label { font-family: var(--mono); font-size: 8px; font-weight: 700; fill: var(--text-hi); letter-spacing: .05em; }

.ov-graph-node { fill: var(--faint); stroke: var(--void); stroke-width: 1.5; }
.ov-graph-node.up { fill: var(--up); }
.ov-graph-node.down { fill: var(--down); }
.ov-graph-glow { fill: var(--faint); opacity: .12; animation: ov-pulse 4.2s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
.ov-graph-glow.up { fill: var(--up); }
.ov-graph-glow.down { fill: var(--down); }

.ov-graph-label { font-size: 8px; fill: var(--faint); font-family: var(--sans); }

@keyframes ov-pulse {
  0%, 100% { opacity: .1; transform: scale(1); }
  50% { opacity: .32; transform: scale(1.22); }
}

.ov-learn-side { display: flex; flex-direction: column; gap: 14px; padding: 4px 8px; }
.ov-learn-row { display: flex; align-items: flex-start; gap: 10px; }
.ov-learn-row > .ph { font-size: 17px; flex-shrink: 0; margin-top: 2px; }
.ov-learn-text { flex: 1; min-width: 0; }
.ov-learn-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ov-learn-title b { font-size: 12.5px; font-weight: 600; }
.ov-learn-sub { font-size: 11px; color: var(--faint); margin-top: 4px; line-height: 1.5; }
.ov-learn-note { font-size: 11px; color: var(--faint); line-height: 1.6; padding-top: 4px; border-top: 1px solid var(--edge-soft); text-wrap: pretty; }

@media (max-width: 980px) {
  .ov-stats { grid-template-columns: repeat(2, 1fr); }
  .ov-grid { grid-template-columns: 1fr; }
  .ov-learn-body { grid-template-columns: 1fr; }
  .signals-split { grid-template-columns: 1fr; height: auto; }
  .signals-list { max-height: 320px; }
}
