/* Agent Monitor — visual language
   Deep indigo rather than the usual fintech near-black, carried over from
   the project's reporting deck so app and documents read as one product.
   Mint = positive, coral = negative: both stay legible on indigo and remain
   distinguishable for the common forms of colour blindness, which the
   conventional green/red does not. */

:root {
  --base:      #161A34;
  --surface:   #1F2547;
  --surface-2: #2A3157;
  --hairline:  #353D6B;

  --ink:       #FFFFFF;
  --ink-mid:   #A6B0D8;
  --ink-faint: #6C77A8;

  --positive:  #4FD6BE;
  --negative:  #FF7A7A;
  --caution:   #F0B354;
  --accent:    #7C86FF;

  --radius: 20px;
  --gutter: 18px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  /* Rounded numerals give figures character without shipping a webfont */
  --font-num: ui-rounded, -apple-system, "SF Pro Rounded", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--base);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

body {
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
  padding-top: env(safe-area-inset-top);
}

/* ---------------------------------------------------------- layout */

.wrap { padding: 0 16px; max-width: 640px; margin: 0 auto; }

header.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 8px;
  max-width: 640px; margin: 0 auto;
}
header.top h1 {
  font: 700 30px/1.1 var(--font-num);
  margin: 0;
  letter-spacing: -0.5px;
}
.icon-btn {
  background: var(--surface); border: 0; color: var(--ink-mid);
  width: 38px; height: 38px; border-radius: 12px;
  font-size: 17px; cursor: pointer;
  display: grid; place-items: center;
}
.icon-btn:active { background: var(--surface-2); }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: var(--gutter);
  margin-bottom: 14px;
}

.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: 1.1px;
  text-transform: uppercase; color: var(--ink-faint);
  margin: 0 0 8px;
}

.muted { color: var(--ink-mid); font-size: 13px; }
.faint { color: var(--ink-faint); font-size: 11px; }

.pos { color: var(--positive); }
.neg { color: var(--negative); }
.cau { color: var(--caution); }

/* ---------------------------------------------------------- figures */

.figure {
  font: 700 40px/1 var(--font-num);
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  margin: 4px 0 6px;
}
.figure.sm { font-size: 26px; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

.pill {
  display: inline-block;
  font-size: 10px; font-weight: 700; letter-spacing: .8px;
  padding: 4px 8px; border-radius: 999px;
  background: rgba(124,134,255,.16); color: var(--accent);
}

.banner {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px; border-radius: 16px; margin-bottom: 14px;
}
.banner.warn { background: rgba(240,179,84,.14); }
.banner.ok   { background: var(--positive); color: var(--base); }
.banner.err  { background: rgba(255,122,122,.16); }
.banner strong { display: block; font-size: 15px; margin-bottom: 2px; }

/* ------------------------------------------------- signal bar
   A diverging bar centred on zero: left of centre means the agent is
   negative on a holding, right means positive. One shared axis makes
   eleven holdings comparable at a glance in a way a column of numbers
   does not. This is the view a brokerage app structurally cannot show. */

.signal { padding: 10px 0; }
.signal + .signal { border-top: 1px solid var(--hairline); }
.signal-head {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px;
}
.signal-head .tick { font: 700 15px var(--font-num); }
.signal-head .verdict { font-size: 11px; }
.signal-head .score { margin-left: auto; font: 600 15px var(--font-num); font-variant-numeric: tabular-nums; }
.signal-head .wt { font-size: 12px; color: var(--ink-faint); width: 44px; text-align: right; }

.bar { position: relative; height: 10px; }
.bar .track {
  position: absolute; inset: 2px 0; border-radius: 999px;
  background: var(--surface-2);
}
.bar .zero {
  position: absolute; left: 50%; top: 0; width: 1px; height: 10px;
  background: var(--hairline);
}
.bar .fill {
  position: absolute; top: 2px; height: 6px; border-radius: 999px;
  transition: width .4s cubic-bezier(.2,.8,.2,1);
}

.metrics { display: flex; gap: 14px; margin-top: 7px; font-size: 11px; }
.metrics span { color: var(--ink-faint); }
.metrics b { font-family: var(--font-num); font-weight: 600; }

/* ---------------------------------------------------------- rows */

.row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
}
.row + .row { border-top: 1px solid var(--hairline); }
.row .grow { flex: 1; min-width: 0; }
.row .sym { font: 700 16px var(--font-num); }
.row .sub { font-size: 11px; color: var(--ink-faint); }
.row .right { text-align: right; }
.row .val { font: 600 15px var(--font-num); font-variant-numeric: tabular-nums; }

.dot {
  width: 30px; height: 30px; border-radius: 999px;
  display: grid; place-items: center; font-size: 14px; flex: none;
}

/* ---------------------------------------------------------- sparkline */

.spark { width: 100%; height: 54px; display: block; margin: 10px 0 4px; }

/* ---------------------------------------------------------- controls */

button.primary, button.ghost {
  width: 100%; border: 0; border-radius: 14px;
  padding: 14px; font: 600 15px var(--font);
  cursor: pointer; margin-top: 4px;
}
button.primary { background: var(--positive); color: var(--base); }
button.ghost   { background: var(--surface-2); color: var(--ink); }
button:disabled { opacity: .45; }

.linkish {
  background: none; border: 0; color: var(--accent);
  font: 600 13px var(--font); cursor: pointer; padding: 0;
}

/* hold-to-confirm: a deliberate 1.5s press, because selling is
   irreversible within the session and a tap can happen by accident */
.hold {
  position: relative; overflow: hidden;
  height: 54px; border-radius: 16px; border: 0; width: 100%;
  background: rgba(255,122,122,.18);
  color: var(--negative); font: 600 16px var(--font);
  cursor: pointer; touch-action: none; user-select: none;
}
.hold .prog {
  position: absolute; inset: 0; width: 0;
  background: var(--negative);
  transition: width .1s linear;
}
.hold .lbl { position: relative; z-index: 1; }
.hold.armed .lbl { color: var(--ink); }

/* ---------------------------------------------------------- sheet */

.sheet-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: none; z-index: 40;
}
.sheet-bg.open { display: block; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--surface);
  border-radius: 26px 26px 0 0;
  padding: 10px 22px calc(22px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.2,.8,.2,1);
  max-width: 640px; margin: 0 auto;
}
.sheet.open { transform: translateY(0); }
.grabber {
  width: 38px; height: 5px; border-radius: 999px;
  background: var(--hairline); margin: 0 auto 18px;
}
.kv { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13px; }
.kv .k { color: var(--ink-mid); }
.kv .v { font-family: var(--font-num); font-weight: 600; }
.kv-box { background: rgba(0,0,0,.22); border-radius: 16px; padding: 14px 16px; margin: 16px 0; }

/* ---------------------------------------------------------- tabs */

nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  background: rgba(31,37,71,.92);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--hairline);
  padding: 8px 0 calc(6px + env(safe-area-inset-bottom));
}
nav.tabs button {
  background: none; border: 0; cursor: pointer;
  color: var(--ink-faint); font: 500 10px var(--font);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px 14px;
}
nav.tabs button .ico { font-size: 19px; line-height: 1; }
nav.tabs button.active { color: var(--accent); }

/* ---------------------------------------------------------- forms */

label.field { display: block; margin-bottom: 14px; }
label.field .lbl { font-size: 13px; color: var(--ink-mid); display: block; margin-bottom: 6px; }
label.field .hint { font-size: 11px; color: var(--ink-faint); margin-top: 6px; display: block; line-height: 1.45; }
input[type=text], input[type=password], input[type=url] {
  width: 100%; padding: 13px 14px;
  background: var(--base); border: 1px solid var(--hairline);
  border-radius: 12px; color: var(--ink);
  font: 400 15px var(--font);
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, #333B69 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px; height: 14px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.hidden { display: none !important; }
