/* PropFirm Reply Desk — visual language
   Subject: a two-person trading-desk cockpit for reply work. The one number
   that matters all day (replies vs target) lives in the header and never
   scrolls away; everything else stays quiet around it.
   Type: Space Grotesk carries UI voice, JetBrains Mono carries every number,
   handle and piece of data — the split IS the hierarchy. */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* ink scale — blue-black, one step warmer than pure black */
  --bg: #0a0d13;
  --surface: #10151f;
  --surface-2: #171e2b;
  --surface-3: #1e2736;
  --line: #242e40;
  --line-strong: #33405a;

  --text: #e9edf4;
  --muted: #8b98ad;
  --faint: #5c6a80;

  /* semantics */
  --up: #3ecf8e;          /* ahead / success / primary action */
  --up-ink: #06251a;
  --up-dim: rgba(62, 207, 142, .12);
  --down: #f0a05a;        /* behind pace / caution */
  --down-dim: rgba(240, 160, 90, .12);
  --danger: #f87171;
  --link: #7da2ff;
  --link-dim: rgba(125, 162, 255, .12);
  --ring: #7da2ff;

  --font-ui: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* 4px rhythm */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
  --tap: 44px;
  --speed: 160ms;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 70% -10%, rgba(125, 162, 255, .05), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font-ui);
  overflow-x: hidden;
  touch-action: manipulation;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.err { color: var(--danger); min-height: 20px; font-size: 13px; }

/* focus is part of the design, not an afterthought */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--r-sm); }

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

/* ---------- login gate ---------- */
.gate { display: grid; place-items: center; min-height: 100dvh; padding: var(--s4); }
.gate form {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: var(--s8);
  border-radius: var(--r-lg);
  width: min(360px, 100%);
}
.gate h1 {
  margin: 0 0 var(--s6);
  font-size: 18px; font-weight: 700; letter-spacing: -.01em;
}
.gate h1::before {
  content: "FP//";
  font-family: var(--font-mono); font-weight: 600;
  color: var(--up); margin-right: var(--s2);
}
.gate input { width: 100%; margin-bottom: var(--s3); min-height: var(--tap); }
.gate button {
  width: 100%; min-height: var(--tap);
  background: var(--up); color: var(--up-ink);
  border: 0; font-weight: 600; font-size: 15px;
}
.gate button:hover { filter: brightness(1.08); }

/* ---------- header / desk strip ---------- */
header {
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s3) var(--s5);
  padding-top: max(var(--s3), env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: baseline; gap: var(--s2); white-space: nowrap; }
.brand-mark {
  font-family: var(--font-mono); font-weight: 600; font-size: 15px;
  color: var(--up); letter-spacing: -.02em;
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }

/* the signature: today's count, always on screen */
.livestat {
  display: flex; align-items: center; gap: var(--s2);
  padding: 5px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono); font-size: 13px; font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.livestat .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--faint); flex: none;
}
.livestat .dot.on { background: var(--up); animation: pulse 2.4s var(--ease) infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(62, 207, 142, .5); }
  50% { box-shadow: 0 0 0 5px rgba(62, 207, 142, 0); }
}
.livestat .pace { font-size: 12px; }
.livestat .pace.ahead { color: var(--up); }
.livestat .pace.behind { color: var(--down); }

.head-right { display: flex; gap: var(--s2); align-items: center; margin-left: auto; min-width: 0; }
/* the model label is long; without a cap it pushes the whole header past the
   viewport on phones and the browser zooms out to fit */
.head-right select { max-width: 38vw; min-width: 0; text-overflow: ellipsis; }
.whoami {
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
  padding: 4px 10px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 999px;
}

/* ---------- controls ---------- */
input, select, textarea, button {
  font: inherit; color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  max-width: 100%;
  transition: border-color var(--speed) var(--ease), background var(--speed) var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { width: 100%; font-family: var(--font-mono); font-size: 13px; line-height: 1.6; resize: vertical; }
select { cursor: pointer; }

button {
  cursor: pointer; min-height: 38px; font-weight: 500;
  transition: border-color var(--speed) var(--ease), background var(--speed) var(--ease),
              transform 90ms var(--ease), filter var(--speed) var(--ease);
}
button:hover { border-color: var(--line-strong); background: var(--surface-3); }
button:active { transform: scale(.97); }
button:disabled { opacity: .5; cursor: wait; transform: none; }
button.ghost { background: transparent; }
button.ghost:hover { background: var(--surface-2); }
button.big {
  background: var(--up); color: var(--up-ink); border: 0;
  font-weight: 700; font-size: 15px; letter-spacing: .01em;
  padding: 12px 36px; border-radius: var(--r-md); min-height: 48px;
}
button.big:hover { filter: brightness(1.08); background: var(--up); }

.row { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
label { display: block; font-size: 12px; color: var(--muted); margin: var(--s4) 0 var(--s1);
        text-transform: uppercase; letter-spacing: .06em; font-weight: 500; }
label.inline { display: inline-flex; gap: var(--s2); align-items: center; margin: 0;
               text-transform: none; letter-spacing: 0; font-size: 13px; }

/* ---------- panels ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  margin: var(--s4) var(--s5);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; gap: var(--s2); width: 100%;
  background: transparent; border: 0; border-radius: 0;
  padding: var(--s4) var(--s5); text-align: left; min-height: var(--tap);
}
.panel-head:hover { background: var(--surface-2); transform: none; }
.panel-head:active { transform: none; }
.panel-head h2 { font-size: 14px; margin: 0; font-weight: 600; letter-spacing: -.01em; }
.panel-head .muted { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.chev { color: var(--faint); flex: none; display: inline-flex;
        transition: transform var(--speed) var(--ease); }
.chev svg { width: 14px; height: 14px; }
.panel.collapsed .chev { transform: rotate(-90deg); }
.panel.collapsed .panel-body { display: none; }
.panel-body { padding: 0 var(--s5) var(--s5); }

/* ---------- tracker ---------- */
.track-grid { display: flex; gap: var(--s6); align-items: flex-start; flex-wrap: wrap; }
.count-box { min-width: 128px; }
.count {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 52px; font-weight: 600; line-height: 1; letter-spacing: -.03em;
}
.count.behind { color: var(--down); }
.count.ahead { color: var(--up); }
.count-box .muted { margin-top: var(--s1); }
.track-ctl { flex: 1; min-width: 250px; }
.bar {
  height: 6px; background: var(--surface-3); border-radius: 999px;
  margin: var(--s3) 0 var(--s2); overflow: hidden;
}
.bar span {
  display: block; height: 100%; width: 0;
  background: var(--up); border-radius: 999px;
  transition: width .4s var(--ease);
}
.bar span.behind { background: var(--down); }
#trkToggle.on { background: var(--down-dim); color: var(--down); border-color: var(--down); font-weight: 600; }
#trkStatus { line-height: 1.7; }

.hours { display: flex; gap: 3px; align-items: flex-end; height: 42px; margin-top: var(--s4); }
.hours div {
  flex: 1; background: var(--link); opacity: .55;
  border-radius: 2px 2px 0 0; min-height: 2px;
  transition: opacity var(--speed) var(--ease);
}
.hours div:hover { opacity: 1; }

.rep { font-size: 13px; padding: var(--s2) 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.rep a { color: var(--link); text-decoration: none; font-family: var(--font-mono); font-size: 12px; }
.rep a:hover { text-decoration: underline; }
details summary { cursor: pointer; padding: var(--s2) 0; user-select: none; }
details summary:hover { color: var(--text); }

/* ---------- scan results ---------- */
#scanStatus { margin-top: var(--s3); overflow-wrap: anywhere; font-family: var(--font-mono); font-size: 12px; line-height: 1.8; }

.card {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: var(--s4); margin-top: var(--s4);
}
.card-head { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.card-head a {
  color: var(--link); font-weight: 600; text-decoration: none;
  font-family: var(--font-mono); font-size: 14px;
}
.card-head a:hover { text-decoration: underline; }
.badge {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-3); color: var(--muted);
  border: 1px solid var(--line); white-space: nowrap;
}
.badge.fresh { background: var(--up-dim); color: var(--up); border-color: transparent; }
.badge.hot { background: var(--link-dim); color: var(--link); border-color: transparent; }

.tweet {
  margin: var(--s3) 0; white-space: pre-wrap; color: #c6cfdd;
  border-left: 2px solid var(--line-strong); padding-left: var(--s3);
  overflow-wrap: anywhere; font-size: 14px;
}
.context {
  font-size: 13px; color: var(--down);
  background: var(--down-dim); border-radius: var(--r-sm);
  padding: var(--s2) var(--s3); margin-bottom: var(--s3);
}

.draft { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) 0; border-top: 1px solid var(--line); }
.draft .frame {
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--faint);
  min-width: 96px; padding-top: 5px; flex: none;
}
.draft .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.draft button { padding: 6px 14px; font-size: 13px; flex: none; }
.draft button.copied { background: var(--up); color: var(--up-ink); border-color: var(--up); }

.gifrow {
  display: flex; gap: var(--s2); align-items: center; margin-top: var(--s3);
  overflow-x: auto; padding-bottom: var(--s1);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.gifrow img {
  height: 64px; border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid var(--line); flex: none;
  transition: border-color var(--speed) var(--ease), transform var(--speed) var(--ease);
}
.gifrow img:hover { border-color: var(--up); transform: translateY(-1px); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 12px;
  background: var(--surface-3); border: 1px solid var(--line);
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
  white-space: nowrap; flex: none;
  transition: border-color var(--speed) var(--ease);
}
.chip:hover { border-color: var(--up); }
.chip svg { width: 13px; height: 13px; color: var(--faint); }

.noterow { display: flex; gap: var(--s2); align-items: center; margin-top: var(--s3); }
.noterow input { flex: 1; min-width: 0; font-size: 13px; }
.noterow button { flex: none; }
.noteby { white-space: nowrap; font-size: 12px; }

/* ---------- translate ---------- */
#trText, #trContext { font-family: var(--font-ui); font-size: 15px; }
#trOut .draft .frame { padding-top: 4px; }

/* ---------- targets ---------- */
.targets { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s2); margin-top: var(--s3); }
.t {
  display: flex; gap: var(--s2); align-items: baseline;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 9px var(--s3);
  font-size: 13px; min-width: 0;
  transition: border-color var(--speed) var(--ease);
}
.t:hover { border-color: var(--line-strong); }
.t a {
  color: var(--link); text-decoration: none; font-weight: 500;
  font-family: var(--font-mono); font-size: 12.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.t a:hover { text-decoration: underline; }
.t .f { color: var(--faint); font-family: var(--font-mono); font-size: 11px;
        margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.t .tier {
  font-family: var(--font-mono); font-size: 9.5px; color: var(--faint);
  flex: none; border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px;
}
#filter { flex: 1; min-width: 140px; }

/* ---------- phones ---------- */
@media (max-width: 680px) {
  .panel { margin: var(--s3); }
  .panel-head { padding: var(--s3) var(--s4); }
  .panel-body { padding: 0 var(--s4) var(--s4); }
  header { padding: var(--s2) var(--s3); padding-top: max(var(--s2), env(safe-area-inset-top)); gap: var(--s2); flex-wrap: wrap; }
  .brand-name { display: none; } /* the mark + live stat carry it */
  .head-right select { max-width: 34vw; }
  .whoami { display: none; } /* name is implicit — you logged in */

  /* below 16px, focused fields make iOS zoom the page */
  input, select, textarea { font-size: 16px; }

  .track-grid { flex-direction: column; gap: var(--s3); }
  .count-box { display: flex; align-items: baseline; gap: var(--s3); min-width: 0; width: 100%; }
  .count { font-size: 42px; }
  .track-ctl { min-width: 0; width: 100%; }
  .track-ctl .row { gap: var(--s2); }
  #trkToggle, #trkNow { flex: 1 1 auto; min-height: var(--tap); }
  #trkHandle { width: 100%; }
  .track-ctl label.inline { flex: 1 1 130px; }
  .track-ctl label.inline select, .track-ctl label.inline input { flex: 1; min-width: 0; }

  .draft { flex-wrap: wrap; gap: var(--s2); }
  .draft .frame { min-width: 0; width: 100%; padding-top: 0; }
  .draft .txt { flex: 1 1 100%; }
  .draft button { min-height: var(--tap); padding: 8px 18px; }
  .noterow button { min-height: var(--tap); }

  button.big { width: 100%; }
  .targets { grid-template-columns: 1fr; }
}
