/* FundMyPrediction — LayerHub-inspired light analytics theme.
   Page plane in cool blue-white, white sidebar + cards, blue gradient hero,
   green data accents (validated vs white: #16a34a / #dc2626). */
:root {
  --page: #eff5fb;
  --card: #ffffff;
  --border: #e2eaf5;
  --ink: #152238;
  --ink-2: #41506b;
  --muted: #7e8ca6;
  --blue: #1f8fff;
  --blue-deep: #0b5cd6;
  --navy: #12203c;
  --green: #16a34a;
  --red: #dc2626;
  --shadow: 0 6px 22px rgba(23, 58, 110, 0.07);
  --radius: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--page); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px; line-height: 1.5;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.hidden { display: none !important; }

/* ---------- shell: sidebar + main ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; flex: none; background: var(--card);
  border-right: 1px solid var(--border);
  padding: 18px 14px; display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 9px; padding: 2px 4px; }
.side-brand .wordmark { font-weight: 800; font-size: 16px; letter-spacing: -0.01em; }
.side-brand .wordmark span { color: var(--blue); }
.side-label { font-size: 11.5px; color: var(--muted); margin: 0 4px -12px; }
.side-search { position: relative; }
.side-search input {
  width: 100%; border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 34px 8px 14px; font-size: 13px; color: var(--ink);
  background: var(--card); outline: none;
}
.side-search input:focus { border-color: var(--blue); }
.side-search svg { position: absolute; right: 12px; top: 9px; }
.nav { display: flex; flex-direction: column; gap: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-radius: 999px; border: 1px solid transparent;
  color: var(--ink-2); font-weight: 600; font-size: 13.5px; text-align: left;
  background: #f3f8fd;
}
.nav-item:hover { border-color: var(--border); }
.nav-item.active { background: var(--card); border-color: var(--blue); color: var(--ink); box-shadow: var(--shadow); }
.nav-item .ico { width: 18px; height: 18px; flex: none; }
.side-foot { margin-top: auto; font-size: 11.5px; color: var(--muted); padding: 0 4px; display: flex; flex-direction: column; gap: 6px; }
.side-foot a:hover { color: var(--ink); }

.main { flex: 1; min-width: 0; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 26px;
  background: linear-gradient(180deg, #eaf4fd, transparent);
}
.crumbs { font-size: 12.5px; color: var(--muted); }
.crumbs b { color: var(--ink); font-weight: 600; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 18px; font-weight: 600; font-size: 13px; box-shadow: var(--shadow);
}
.pill-btn:hover { border-color: var(--blue); }
.pill-btn.navy { background: var(--navy); color: #fff; border-color: var(--navy); }
.pill-btn.navy:hover { background: #1b2f56; }
.acct-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 7px 14px; font-size: 12.5px; box-shadow: var(--shadow); }
.acct-chip b { font-variant-numeric: tabular-nums; }
.acct-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.acct-chip .dot.bad { background: var(--red); }
.link-btn { color: var(--muted); font-size: 12.5px; }
.link-btn:hover { color: var(--ink); }

.content { padding: 4px 26px 44px; max-width: 1280px; }

/* ---------- hero banner ---------- */
.hero {
  border-radius: var(--radius); color: #fff;
  background:
    radial-gradient(700px 260px at 85% -30%, rgba(255,255,255,0.28), transparent 60%),
    radial-gradient(500px 300px at 55% 130%, rgba(9,50,120,0.35), transparent 65%),
    linear-gradient(105deg, #0b63d8 0%, #2f9df1 58%, #64bef5 100%);
  padding: 22px 26px; box-shadow: var(--shadow);
  display: flex; gap: 26px; flex-wrap: wrap;
}
.hero-left { flex: 1 1 400px; min-width: 300px; }
.hero-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hero-title h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.hero-mark { width: 44px; height: 44px; border-radius: 12px; }
.updated-pill {
  background: rgba(9, 30, 66, 0.45); border-radius: 999px;
  font-size: 11px; padding: 4px 12px; font-weight: 600;
}
.hero-stats { display: flex; gap: 34px; margin-top: 18px; flex-wrap: wrap; }
.hstat .lbl { font-size: 11px; letter-spacing: 0.06em; opacity: 0.85; }
.hstat .val { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hero-right { flex: 0 1 320px; min-width: 260px; display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.hero-right p { font-size: 13px; opacity: 0.95; }
.hero-cta {
  background: #fff; color: var(--ink); border-radius: 999px;
  padding: 10px 20px; font-weight: 700; font-size: 13.5px; text-align: center;
  box-shadow: 0 4px 14px rgba(9, 30, 66, 0.25); align-self: flex-start;
}
.hero-cta:hover { background: #f1f7ff; }

/* ---------- tabs & section headers ---------- */
.tabs { display: flex; gap: 26px; margin: 20px 4px 6px; border-bottom: 1px solid var(--border); }
.tab { padding: 9px 2px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; font-size: 14px; }
.tab.active { color: var(--ink); border-bottom-color: var(--blue); }
.section-head { display: flex; align-items: center; gap: 9px; margin: 22px 4px 12px; color: var(--muted); font-weight: 700; font-size: 15px; }
.section-head .ico-circle {
  width: 26px; height: 26px; border-radius: 50%; background: #dbe9f8;
  display: inline-flex; align-items: center; justify-content: center; color: var(--blue-deep);
}

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.card-head h3 { font-size: 15px; font-weight: 700; }
.card-head .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.select-pill { border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; font-size: 12px; color: var(--ink-2); background: var(--card); }
.select-pill.active { border-color: var(--blue); color: var(--ink); }
.two-col { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; }
@media (max-width: 980px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- market grid ---------- */
.cat-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.cat-pill { border: 1px solid var(--border); background: var(--card); border-radius: 999px; padding: 6px 15px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.cat-pill.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.mcard { cursor: pointer; transition: border-color 0.15s, transform 0.15s; display: flex; flex-direction: column; gap: 9px; }
.mcard:hover { border-color: var(--blue); transform: translateY(-1px); }
.mcard-head { display: flex; gap: 10px; align-items: flex-start; }
.mcard-icon { width: 36px; height: 36px; border-radius: 9px; object-fit: cover; background: #eef4fb; flex: none; }
.mcard-title { font-weight: 700; font-size: 13.5px; }
.mcard-chance { margin-left: auto; text-align: right; flex: none; }
.mcard-chance .pct { font-size: 19px; font-weight: 800; color: var(--blue-deep); }
.mcard-chance .lbl { font-size: 10.5px; color: var(--muted); }
.spark { width: 100%; height: 42px; }
.outcome-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.outcome-line .bar { height: 5px; border-radius: 3px; background: linear-gradient(90deg, #86e3a5, var(--green)); flex: none; }
.outcome-line .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outcome-line .val { margin-left: auto; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.mcard-foot { display: flex; gap: 12px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }

/* ---------- account view ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { background: #f6faff; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.tile .lbl { font-size: 10.5px; letter-spacing: 0.07em; color: var(--muted); font-weight: 700; }
.tile .val { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tile .val.up { color: var(--green); } .tile .val.down { color: var(--red); }
.tile .sub { font-size: 11.5px; color: var(--muted); }
.status-pill { font-size: 11px; font-weight: 800; letter-spacing: 0.05em; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border); background: #f6faff; color: var(--ink-2); }
.status-pill.active { color: var(--blue-deep); border-color: #b7d7f8; background: #e9f3fe; }
.status-pill.passed { color: var(--green); border-color: #b3e2c4; background: #ebf9f0; }
.status-pill.failed { color: var(--red); border-color: #f2c4c4; background: #fdeeee; }
.rules-bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 14px; }
.rule-lbl { font-size: 11.5px; color: var(--muted); margin-bottom: 5px; display: flex; justify-content: space-between; font-weight: 600; }
.bar-track { height: 7px; border-radius: 4px; background: #e6eef8; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; transition: width 0.4s; }
.bar-fill.target { background: linear-gradient(90deg, #6db5ff, var(--blue-deep)); }
.bar-fill.buffer { background: linear-gradient(90deg, #86e3a5, var(--green)); }
.bar-fill.low { background: linear-gradient(90deg, #f3a6a6, var(--red)); }
.pos-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.data-table th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 700; padding: 7px 8px; border-bottom: 1px solid var(--border); letter-spacing: 0.04em; }
.data-table td { padding: 8px; border-bottom: 1px solid #eef3fa; font-variant-numeric: tabular-nums; }
.data-table td.num, .data-table th.num { text-align: right; }
.data-table tr.clickable { cursor: pointer; }
.data-table tr.clickable:hover td { background: #f6faff; }
.pnl-up { color: var(--green); font-weight: 700; } .pnl-down { color: var(--red); font-weight: 700; }
.sell-mini { font-size: 11px; color: var(--red); border: 1px solid #f2c4c4; border-radius: 999px; padding: 3px 10px; font-weight: 600; }
.sell-mini:hover { background: #fdeeee; }
.muted-note { color: var(--muted); font-size: 12.5px; margin-top: 10px; }

/* ---------- checkout / email preview ---------- */
.checkout-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 10px 0 16px; }
.tier-opt { border: 1px solid var(--border); border-radius: 12px; padding: 12px; text-align: center; cursor: pointer; background: #f8fbff; }
.tier-opt.active { border-color: var(--blue); background: #e9f3fe; box-shadow: var(--shadow); }
.tier-opt .tname { font-weight: 800; font-size: 16px; }
.tier-opt .tfee { font-size: 12px; color: var(--muted); }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; display: block; margin-bottom: 5px; }
.field input {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 13px; font-size: 14px; color: var(--ink); outline: none; background: var(--card);
}
.field input:focus { border-color: var(--blue); }
.cta-btn { background: var(--blue-deep); color: #fff; border-radius: 999px; padding: 11px 24px; font-weight: 700; font-size: 14px; margin-top: 14px; }
.cta-btn:hover { background: #0a51bd; }
.cta-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.email-card { border: 1px solid var(--border); border-radius: 12px; margin-top: 16px; overflow: hidden; }
.email-head { background: #f2f7fd; padding: 10px 16px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); }
.email-head b { color: var(--ink); display: block; font-size: 13px; }
.email-body { padding: 16px; font-size: 13.5px; color: var(--ink-2); }
.magic-btn { display: inline-block; background: var(--green); color: #fff; border-radius: 999px; padding: 10px 22px; font-weight: 700; margin-top: 12px; }
.magic-btn:hover { background: #128a3e; }
.seam-note { font-size: 11.5px; color: var(--muted); margin-top: 8px; }

/* ---------- detail modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(16, 33, 63, 0.45); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 16px; z-index: 30; overflow-y: auto; }
.modal { background: var(--card); border-radius: var(--radius); width: min(900px, 100%); padding: 20px 22px; box-shadow: 0 20px 60px rgba(9, 30, 66, 0.25); }
.modal-head { display: flex; gap: 12px; align-items: center; }
.modal-head h2 { font-size: 17px; }
.modal-sub { font-size: 12px; color: var(--muted); }
.close { margin-left: auto; color: var(--muted); font-size: 15px; padding: 6px 10px; border-radius: 8px; }
.close:hover { background: #f2f7fd; color: var(--ink); }
.outcome-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.outcome-chip { border: 1px solid var(--border); border-radius: 999px; padding: 6px 13px; font-size: 12.5px; color: var(--ink-2); background: #f8fbff; font-weight: 600; }
.outcome-chip.active { border-color: var(--blue); color: var(--ink); background: #e9f3fe; }
.outcome-chip b { font-variant-numeric: tabular-nums; }
.chart-head { display: flex; align-items: baseline; margin-top: 8px; }
.chart-price { font-size: 27px; font-weight: 800; }
.chart-delta { font-size: 13.5px; font-weight: 700; margin-left: 10px; }
.chart-delta.up { color: var(--green); } .chart-delta.down { color: var(--red); }
.ranges { margin-left: auto; display: flex; gap: 4px; }
.ranges button { padding: 4px 11px; border-radius: 999px; font-size: 12px; color: var(--muted); font-weight: 600; }
.ranges button.active { background: #e9f3fe; color: var(--blue-deep); }
.chart-wrap { position: relative; margin-top: 4px; }
.tooltip { position: absolute; pointer-events: none; background: var(--navy); color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -115%); }
.tooltip b { font-variant-numeric: tabular-nums; }
.book-grid { display: grid; grid-template-columns: 225px 1fr 1fr; gap: 20px; margin-top: 16px; }
@media (max-width: 840px) { .book-grid { grid-template-columns: 1fr; } }
.book-grid h3 { font-size: 13px; color: var(--ink-2); margin-bottom: 8px; font-weight: 700; }
.book-grid .src { font-weight: 500; font-size: 11px; color: var(--muted); }
.book { display: flex; flex-direction: column; gap: 3px; font-variant-numeric: tabular-nums; }
.book-row { display: grid; grid-template-columns: 50px 1fr 74px; gap: 8px; align-items: center; font-size: 12px; }
.book-row .price { color: var(--ink-2); font-weight: 600; }
.book-row .depth { height: 12px; border-radius: 4px; }
.book-row.bid .depth { background: linear-gradient(90deg, #86e3a5, var(--green)); }
.book-row.ask .depth { background: linear-gradient(90deg, #f3a6a6, var(--red)); }
.book-row .size { text-align: right; color: var(--muted); }
.book-mid { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 5px 2px; margin: 4px 0; }
.meta { width: 100%; border-collapse: collapse; font-size: 13px; }
.meta td { padding: 6px 2px; border-bottom: 1px solid #eef3fa; }
.meta td:first-child { color: var(--muted); }
.meta td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.ticket-sides { display: flex; gap: 6px; margin-bottom: 10px; }
.side-btn { flex: 1; padding: 7px 0; border-radius: 999px; font-weight: 700; font-size: 13px; border: 1px solid var(--border); color: var(--muted); background: #f8fbff; }
.side-btn.buy.active { color: #fff; background: var(--green); border-color: var(--green); }
.side-btn.sell.active { color: #fff; background: var(--red); border-color: var(--red); }
.ticket-amount label { font-size: 11.5px; color: var(--muted); display: block; margin-bottom: 4px; font-weight: 600; }
.ticket-amount input { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-size: 14px; outline: none; font-variant-numeric: tabular-nums; }
.ticket-amount input:focus { border-color: var(--blue); }
.quick { display: flex; gap: 4px; margin-top: 6px; }
.quick button { flex: 1; font-size: 11px; color: var(--ink-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px 0; font-weight: 600; }
.quick button:hover { border-color: var(--blue); }
.t-preview { font-size: 12.5px; color: var(--ink-2); margin: 10px 0; min-height: 32px; }
.t-preview b { font-variant-numeric: tabular-nums; }
.t-submit { width: 100%; padding: 10px 0; border-radius: 999px; font-weight: 800; font-size: 14px; color: #fff; }
.t-submit.buy { background: var(--green); } .t-submit.buy:hover { background: #128a3e; }
.t-submit.sell { background: var(--red); } .t-submit.sell:hover { background: #c11f1f; }
.t-submit:disabled { opacity: 0.45; cursor: not-allowed; }
.t-msg { font-size: 12.5px; margin-top: 8px; min-height: 16px; font-weight: 600; }
.t-msg.ok { color: var(--green); } .t-msg.err { color: var(--red); }
.t-holding { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ---------- live activity feed (all traders) ---------- */
.act-list { display: flex; flex-direction: column; }
.act-row { display: flex; gap: 8px; align-items: center; font-size: 12.5px; padding: 6px 2px; border-bottom: 1px solid #eef3fa; }
.act-side { font-weight: 800; width: 14px; text-align: center; }
.act-side.buy { color: var(--green); } .act-side.sell { color: var(--red); }
.act-name { font-weight: 700; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-what { color: var(--ink-2); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-amt { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.act-amt.buy { color: var(--green); } .act-amt.sell { color: var(--red); }
.act-ts { color: var(--muted); font-size: 11px; white-space: nowrap; min-width: 34px; text-align: right; }
@keyframes actflash { from { background: #e2f6ea; } to { background: transparent; } }
.act-row.flash { animation: actflash 1.6s ease-out; }
@media (prefers-reduced-motion: reduce) { .act-row.flash { animation: none; } }

/* ---------- admin ---------- */
.admin-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.events-list { font-size: 12.5px; }
.events-list .ev-row { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid #eef3fa; }
.events-list .ev-type { font-weight: 700; min-width: 120px; }
.events-list .ev-type.bad { color: var(--red); } .events-list .ev-type.good { color: var(--green); }
.events-list .ev-ts { color: var(--muted); margin-left: auto; white-space: nowrap; }
.admin-actions { display: flex; gap: 8px; margin-top: 12px; }

.pagefoot { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }

/* ---------- responsive: tablet ---------- */
@media (max-width: 1080px) {
  .hero { padding: 20px; gap: 20px; }
  .hero-stats { gap: 24px; margin-top: 14px; }
  .hstat .val { font-size: 19px; }
  .hero-title h1 { font-size: 21px; }
}

/* ---------- responsive: mobile — sidebar becomes a sticky top strip ---------- */
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar {
    position: sticky; top: 0; z-index: 30; height: auto; width: 100%;
    flex-direction: row; align-items: center; gap: 10px;
    padding: 10px 14px; border-right: none; border-bottom: 1px solid var(--border);
    overflow-x: auto; scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .side-brand { flex: none; }
  .side-brand .wordmark { display: none; } /* mark only — the pages are self-titled */
  .side-label, .side-foot { display: none; }
  .side-search { flex: 1 1 140px; min-width: 120px; }
  .nav { flex-direction: row; gap: 6px; flex: none; }
  .nav-item { padding: 8px 12px; font-size: 12.5px; gap: 6px; white-space: nowrap; }

  .topbar { padding: 10px 14px; }
  .crumbs { display: none; }
  .content { padding: 4px 14px 40px; }
  .tabs { gap: 18px; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }

  .hero { padding: 18px 16px; }
  .hero-right { min-width: 0; }
  .hero-cta { align-self: stretch; text-align: center; }

  .modal-backdrop { padding: 2vh 8px; }
  .modal { padding: 16px 14px; }
  .chart-head { flex-wrap: wrap; gap: 8px; }
  .ranges { margin-left: 0; }
  .chart-price { font-size: 22px; }
  .acct-tiles .tile .val, .tiles .tile .val { font-size: 18px; }
  .admin-tiles { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
}

/* touch devices: bigger targets, and 16px inputs so iOS doesn't zoom on focus */
@media (pointer: coarse), (max-width: 860px) {
  .side-search input, .ticket-amount input, .field input { font-size: 16px; }
  .quick button { padding: 8px 0; font-size: 12px; }
  .outcome-chip { padding: 8px 13px; }
  .cat-pill, .tab { padding-top: 8px; padding-bottom: 8px; }
  .sell-mini { padding: 6px 12px; }
}

@media (prefers-reduced-motion: reduce) { .bar-fill, .mcard { transition: none; } }
