/* Pawsperity public viewer — minimal subset of the main dashboard's styling
   sufficient to render the read-only topbar + positions table. Designed to
   match the trading app visually so it feels like the same product, but
   carries no shared logic and no API keys. */

:root {
  --bg:        #0e0e1a;
  --panel:     #15152a;
  --panel-2:   #1c1c34;
  --border:    #2a2a44;
  --text:      #c8c8e0;
  --muted:     #7a7a99;
  --accent:    #10b981;
  --accent-2:  #34d399;
  --accent-3:  #6ee7b7;
}

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "SF Mono", "Menlo", "Monaco", "Courier New", monospace;
  -webkit-font-smoothing: antialiased;
}

.shell { max-width: 1400px; margin: 0 auto; padding: 24px 48px 32px; }

/* ── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  border-radius: 6px;
  padding: 16px 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 22%),
    linear-gradient(135deg, var(--panel) 0%, var(--panel-2) 100%);
  border-top: 1px solid rgba(255,255,255,0.07);
  border-left: 1px solid rgba(255,255,255,0.04);
  border-right: 1px solid rgba(0,0,0,0.35);
  border-bottom: 1px solid rgba(0,0,0,0.45);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    inset 0 -1px 0 rgba(0,0,0,0.3),
    0 6px 18px -8px rgba(0,0,0,0.65);
  margin-bottom: 22px;
}

/* Brand block: 2-col grid (paw / text) × 3 rows (title, tagline, status).
   Paw lives in row 1 only and centers on the title row, so the paw's
   vertical centerline aligns with the PAWSPERITY headline. Tagline +
   status stack in column 2 below the title, so they're indented under
   the headline (not under the paw). */
.brand {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 14px;
  align-items: center;
  flex-shrink: 0;
}
.paw-wrap {
  position: relative;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%,
    rgba(110,231,183,0.22), rgba(16,185,129,0.10) 35%, transparent 75%);
  grid-column: 1;
  grid-row: 1;        /* spans only the title row → centers on it */
  align-self: center;
}
.paw-wrap::before {
  content: ""; position: absolute; inset: -3px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16,185,129,0.18), transparent 60%);
  filter: blur(5px); z-index: -1;
}
.paw { width: 32px; height: 32px; }

.brand-title    { grid-column: 2; grid-row: 1; }
.brand-tagline  { grid-column: 2; grid-row: 2; }
.status         { grid-column: 2; grid-row: 3; }

.brand-title {
  font-size: 18px; font-weight: 700; letter-spacing: 0.18em;
  color: var(--accent); text-transform: uppercase; white-space: nowrap;
}
.brand-tagline {
  font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted); opacity: 0.75; margin-top: 1px; white-space: nowrap;
}
/* Market status chip — single-line inline (dot · primary · sub),
   matching the Streamlit topbar's .pp-status-row.two-line treatment.
   Sizes are deliberately small (10px / 9px / 6px) so the chip reads
   as a tertiary status indicator under the brand title. */
.status {
  font-size: 10px; margin-top: 8px;
  display: flex; align-items: center; gap: 14px;
}
.status > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.15;
}
.status .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted);
}
.status .dot.open  { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.status .dot.closed { background: #5a1f1f; }
.status .primary { font-weight: 600; color: var(--text); letter-spacing: 0.04em; }
.status .sub { font-size: 9px; color: var(--muted); letter-spacing: 0.04em; }
/* Faint "·" between primary and sub. `:not(:empty)` keeps it from
   rendering a dangling dot when the market has no next_open/close. */
.status .sub:not(:empty)::before {
  content: "·";
  margin-right: 4px;
  color: var(--muted);
  opacity: 0.55;
}

.sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }

.money-block {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 18px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(0,0,0,0.18), rgba(0,0,0,0.06));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.03),
    inset 0 -1px 0 rgba(0,0,0,0.35);
}
.money { display: flex; flex-direction: column; gap: 6px; min-width: 200px; }
.money-tile { display: flex; align-items: baseline; gap: 10px; line-height: 1.1; }
.money-tile:first-child { padding-bottom: 5px; border-bottom: 1px solid var(--border); }
.money-label {
  font-size: 10px; letter-spacing: 0.1em; color: var(--muted);
  text-transform: uppercase;
}
.money-value {
  font-size: 15px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 8px;
  white-space: nowrap;
}
.money-value.accent { color: var(--accent); }
.money-value.small { font-size: 12px; font-weight: 500; color: var(--text); }
.delta {
  font-size: 11px; font-weight: 600;
  padding: 2px 6px; border-radius: 3px; font-variant-numeric: tabular-nums;
}
.delta.up   { color: var(--accent-2); background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.35); }
.delta.down { color: #fca5a5;        background: rgba(239,68,68,0.12);   border: 1px solid rgba(239,68,68,0.35); }
.delta.flat { color: var(--muted);   background: rgba(122,122,153,0.12); border: 1px solid var(--border); }

.bench-block {
  display: flex; flex-direction: column; gap: 5px;
  padding-left: 10px; border-left: 1px solid var(--border);
  min-width: 85px;
}
.bench-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px;
  font-size: 10px; font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em; line-height: 1.1;
}
.bench-row .ticker { font-weight: 700; letter-spacing: 0.10em; color: var(--text); }
.bench-row .pct { font-weight: 600; }
.bench-row .pct.up   { color: var(--accent-2); }
.bench-row .pct.down { color: #fca5a5; }
.bench-row .pct.flat { color: var(--muted); }

/* ── Right-edge meta group: Kobe-mode line + tiles row ──────────────────── */
/* Stacks vertically: "Kobe is <mode>" on top, then a row of two tiles
   (Last activity / Next event). The kobe-mode line is horizontally
   centered above the tiles row. The group stays vertically centered
   inside .topbar because .topbar's align-items is `center` and the
   meta-block's natural height is smaller than the brand block on the
   left. */
.meta-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.kobe-mode {
  font-size: 12px;
  color: var(--text);
  letter-spacing: 0.04em;
  white-space: nowrap;
  /* Reserve vertical space even when the mode is unknown — prevents the
     tiles row from jumping up on first paint or when kobe_mode is null. */
  min-height: 14px;
}
/* Cat verb (pouncing / stalking / prowling / loafing / zooming) —
   accent-green so it pops as the personality bit of the sentence. */
.kobe-mode-verb {
  color: var(--accent-3);
  font-weight: 700;
  text-transform: lowercase;
  letter-spacing: 0.06em;
}
/* Trading style ("Momentum", "Mad Max", etc.) — bold but in normal text
   color, with original casing preserved (no text-transform). Keeps the
   hierarchy clear: green = personality, white-bold = the system label. */
.kobe-mode-style {
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.meta-tiles {
  display: flex;
  gap: 22px;
  align-items: center;
}
.meta-tile { line-height: 1.3; white-space: nowrap; }
.meta-lbl {
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
}
.meta-val {
  color: var(--text); font-weight: 600; font-size: 12px;
  margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.meta-val .chip {
  display: inline-block;
  font-size: 9px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
  padding: 1px 5px; margin-left: 6px;
  border: 1px solid var(--border); border-radius: 3px;
  background: rgba(0, 0, 0, 0.20);
}

/* ── Section head + positions table ─────────────────────────────────────── */
.section-head {
  font-size: 11px; font-weight: 600; letter-spacing: 0.20em;
  text-transform: uppercase; color: var(--muted);
  margin: 24px 0 8px; padding: 0;
}
.table-frame {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: linear-gradient(135deg, var(--panel), var(--panel-2));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    inset 0 -1px 0 rgba(0,0,0,0.25);
  overflow: hidden;
}
.pp-table {
  width: 100%;
  border-collapse: separate; border-spacing: 0;
  font-family: inherit; font-size: 13px;
  color: var(--text); margin: 0;
}
.pp-table thead th {
  background: rgba(0,0,0,0.22);
  color: var(--muted);
  font-weight: 600; font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase;
  text-align: left; padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.pp-table th.num, .pp-table td.num {
  text-align: right; font-variant-numeric: tabular-nums;
}
.pp-table tbody td {
  padding: 6px 16px;
  border-bottom: 1px solid rgba(42,42,68,0.5);
  letter-spacing: 0.02em; line-height: 1.3;
}
.pp-table tbody tr:last-child td { border-bottom: none; }
.pp-table tbody tr:hover td { background: rgba(16,185,129,0.04); }
.pp-table .ticker { font-weight: 700; letter-spacing: 0.06em; color: var(--text); }
.pp-table .type-stock, .pp-table .type-option {
  display: inline-block; font-size: 10px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 1px 7px; border-radius: 3px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.20);
  color: var(--muted);
}
.pp-table .type-option {
  color: var(--accent-3);
  border-color: rgba(110,231,183,0.30);
  background: rgba(16,185,129,0.08);
}
.pp-table .pos { color: var(--accent-2); font-weight: 600; }
.pp-table .neg { color: #fca5a5; font-weight: 600; }
.pp-table .flat { color: var(--muted); }
.pp-table .muted { color: var(--muted); }
.pp-table th.center, .pp-table td.center {
  text-align: center; font-variant-numeric: tabular-nums;
}

/* Kobe-tracked table specifics — embedded percent chip on Stop/Target
   cells, and the thesis column with hover-tooltip overflow. */
.pp-table .stop-cell .pct  { color: #fca5a5;        margin-left: 4px; font-size: 11px; }
.pp-table .target-cell .pct { color: var(--accent-2); margin-left: 4px; font-size: 11px; }
.pp-table .thesis {
  color: var(--muted);
  font-style: italic;
  font-size: 12px;
}
/* Constrain the visible width via an inner div (max-width on <td> is
   unreliable across table-layout: auto). Ellipsis on overflow, full text
   exposed via the `title` attribute on the <td> — modern browsers show it
   as a native tooltip on hover. */
.pp-table .thesis .thesis-text {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pp-table td.thesis[title] {
  cursor: help;
}

/* ── Performance section ────────────────────────────────────────────────── */
.perf-frame {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: linear-gradient(135deg, var(--panel), var(--panel-2));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    inset 0 -1px 0 rgba(0,0,0,0.25);
  padding: 18px 22px;
}

/* Range pills row (1W / 1M / 3M / YTD / All). Currently only the 3M pill
   is "active" since the publisher emits a single ~63-row daily history;
   the others are kept as inert markers so the layout matches the live
   dashboard and a future build can light them up without HTML churn. */
.range-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
}
.range-row .range-label { color: var(--muted); margin-right: 6px; }
.range-pill {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--muted);
  cursor: pointer;
  letter-spacing: 0.12em;
  font-size: 10px;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  user-select: none;
}
.range-pill:hover {
  color: var(--text);
  border-color: rgba(122, 122, 153, 0.55);
}
.range-pill.active {
  color: var(--accent-3);
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.12);
}
.range-pill.active:hover {
  color: var(--accent-3);
  border-color: rgba(16, 185, 129, 0.55);
}
.range-pill.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.range-pill.disabled:hover {
  color: var(--muted);
  border-color: var(--border);
}

.equity-chart-wrap { position: relative; }
.equity-chart {
  display: block; width: 100%; height: 280px;
  background: rgba(0, 0, 0, 0.20);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.equity-y-axis {
  position: absolute; top: 0; left: 6px;
  display: flex; flex-direction: column; justify-content: space-between;
  height: 100%; padding: 8px 0;
  font-size: 9px; color: var(--muted); letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.equity-x-axis {
  display: flex; justify-content: space-between;
  margin-top: 6px; padding: 0 12px;
  font-size: 9px; color: var(--muted); letter-spacing: 0.04em;
}

.perf-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 18px;
}
.perf-stat {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.22);
}
.perf-stat .lbl {
  font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
}
.perf-stat .val {
  font-size: 18px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums; margin-top: 4px;
}
.perf-stat .val.up   { color: var(--accent-2); }
.perf-stat .val.down { color: #fca5a5; }
.perf-stat .sub {
  font-size: 9px; color: var(--muted);
  letter-spacing: 0.06em; margin-top: 2px;
  min-height: 11px;  /* reserve space so missing sub doesn't jitter the row */
}

/* ── Trade log table specifics ──────────────────────────────────────────── */
.tlog-caption {
  font-size: 10px; color: var(--muted);
  letter-spacing: 0.04em; margin: 4px 0 8px;
}
.tlog-footer {
  padding: 8px 16px;
  font-size: 10px; color: var(--muted);
  letter-spacing: 0.04em; text-align: center;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
}
.pp-table .action-buy   { color: var(--accent-3); font-weight: 600; }
.pp-table .action-sell  { color: #fca5a5;        font-weight: 600; }
.pp-table .action-close { color: var(--muted);   font-weight: 600; }

.footer {
  font-size: 10px; color: var(--muted);
  letter-spacing: 0.1em; text-transform: uppercase;
  margin-top: 14px; text-align: center;
}

/* ── Mobile (≤1024px) ───────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .shell { padding: 16px clamp(12px, 4vw, 48px); }
  .topbar {
    flex-direction: column; align-items: stretch;
    gap: 14px; padding: 14px 16px;
  }
  /* On mobile the tagline + status are hidden, so the grid is just
     paw + title. Collapse both columns to content width and center the
     pair in the topbar. (Without `auto auto` the desktop `1fr` would
     eat all the slack and the `justify-content` would be a no-op.) */
  .brand {
    grid-template-columns: auto auto;
    justify-content: center;
  }
  .brand-tagline, .status { display: none; }
  .sep { display: none; }
  .money-block { max-width: 385px; margin: 0 auto; }
  /* On mobile, keep the meta-block stacked but center its contents and
     drop the right-alignment used at desktop width. */
  .meta-block {
    margin-left: 0;
    align-items: center;
    gap: 10px;
  }
  .kobe-mode { text-align: center; }
  .meta-tiles {
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
  }
  /* Kobe-tracked: let the table swipe horizontally on phones rather than
     squashing 11 columns into 375px. */
  .table-frame { overflow-x: auto; }
  .pp-table { min-width: 720px; }

  /* Performance section — tighten padding, shrink chart height, stack
     stat tiles into a 2-up grid so values stay readable. */
  .perf-frame { padding: 14px 14px; }
  .equity-chart { height: 200px; }
  .perf-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .perf-stat .val { font-size: 16px; }
  .range-row { flex-wrap: wrap; gap: 6px; }
}
