/* dashboard/server/static/style.css
   Look: dark grey, green = up, red = down, purple = hype / early radar.
   CSS "variables" (--name) are like constants at the top of a Lua file. */
:root {
  --page: #1C1D21;
  --card: #26282E;
  --card-2: #2E3138;
  --line: #3A3D45;
  --text: #ECEDEF;
  --muted: #9A9EA8;
  --faint: #6C707A;
  --up: #3DD68C;
  --down: #FF7A7A;
  --hype: #B79CFF;
  --warn: #F5C451;
  --up-bg: rgba(61, 214, 140, .14);
  --down-bg: rgba(255, 122, 122, .14);
  --hype-bg: rgba(183, 156, 255, .14);
  --warn-bg: rgba(245, 196, 81, .14);
  --radius: 18px;
  --head: "Space Grotesk", "Inter", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tabbar: 68px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--text);
  font: 15px/1.45 var(--body); -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 12px);
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: var(--hype); text-decoration: none; }
h1, h2, h3 { font-family: var(--head); margin: 0; letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.up { color: var(--up); } .down { color: var(--down); } .hype { color: var(--hype); } .warn { color: var(--warn); }

/* --- header --- */
.top {
  position: sticky; top: 0; z-index: 5; background: rgba(28, 29, 33, .92);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding: calc(env(safe-area-inset-top) + 12px) 18px 10px;
  display: flex; align-items: center; gap: 10px; border-bottom: 1px solid transparent;
}
.top.scrolled { border-bottom-color: var(--line); }
.brand { font-family: var(--head); font-weight: 700; font-size: 19px; flex: 1; }
.brand small { display: block; font: 12px var(--body); color: var(--muted); font-weight: 400; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; background: var(--card-2); white-space: nowrap;
}
.chip.up { background: var(--up-bg); } .chip.down { background: var(--down-bg); }
.chip.hype { background: var(--hype-bg); } .chip.warn { background: var(--warn-bg); }

main { max-width: 1120px; margin: 0 auto; padding: 6px 14px 0; overflow-x: hidden; }
.view { display: none; animation: fade .25s ease; }
.view.on { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 4px 10px; }
.section-title h2 { font-size: 17px; }
.section-title span { font-size: 12.5px; color: var(--muted); }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; }
.banner { border-radius: 14px; padding: 12px 14px; font-size: 13.5px; margin-top: 10px; }
.banner.warn { background: var(--warn-bg); color: #F8D98A; }
.banner.down { background: var(--down-bg); color: #FFB4B4; }
.banner.info { background: var(--card); color: var(--muted); }

/* --- hero (top pick) --- */
.hero { padding: 18px 16px 14px; margin-top: 8px; cursor: pointer; }
.hero .label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.hero .row1 { display: flex; justify-content: space-between; align-items: flex-start; margin-top: 6px; gap: 12px; }
.hero .sym { font-family: var(--head); font-size: 30px; font-weight: 700; line-height: 1.05; }
.hero .name { color: var(--muted); font-size: 13.5px; }
.hero .price { font-family: var(--head); font-size: 24px; font-weight: 600; text-align: right; }
.range-note { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.proof {
  margin-top: 12px; background: var(--card-2); border-radius: 12px; padding: 10px 12px;
  display: flex; gap: 12px; align-items: center; font-size: 13px;
}
.proof b { font-family: var(--head); font-size: 20px; }

/* --- list rows --- */
.list { display: grid; gap: 8px; }
@media (min-width: 760px) { .list { grid-template-columns: 1fr 1fr; } }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) 74px auto; align-items: center; gap: 12px;
  background: var(--card); border-radius: 16px; padding: 12px 14px; text-align: left; width: 100%;
  transition: background .15s;
}
.row:active, .row:hover { background: var(--card-2); }
.row .sym { font-family: var(--head); font-weight: 700; font-size: 16px; }
.row .name { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .right { text-align: right; min-width: 78px; }
.row .price { font-weight: 600; font-size: 14px; }
.row .chg { font-size: 12.5px; font-weight: 600; }
.score { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: 2px; }
.score i { width: 5px; height: 5px; border-radius: 50%; background: var(--line); }
.score i.on { background: currentColor; }
.spark { width: 74px; height: 30px; display: block; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.badge { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--card-2); color: var(--muted); }
.badge.up { background: var(--up-bg); color: var(--up); }
.badge.down { background: var(--down-bg); color: var(--down); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.hype { background: var(--hype-bg); color: var(--hype); }
.empty { color: var(--muted); text-align: center; padding: 28px 12px; background: var(--card); border-radius: 16px; font-size: 14px; }

/* --- stat tiles --- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--card); border-radius: 16px; padding: 14px; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-family: var(--head); font-size: 24px; font-weight: 700; margin-top: 2px; }
.tile .s { font-size: 12px; color: var(--muted); }

/* --- tables --- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 8px; font-size: 12px; }
.table td { padding: 9px 8px; border-top: 1px solid var(--line); }
.table td.r, .table th.r { text-align: right; }
.bar { position: relative; height: 6px; background: var(--card-2); border-radius: 3px; min-width: 80px; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; }
.bar b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: .7; }

.filters { display: flex; gap: 6px; margin: 4px 0 10px; overflow-x: auto; }
.filters button { padding: 6px 12px; border-radius: 999px; background: var(--card); color: var(--muted); font-size: 13px; font-weight: 600; }
.filters button.on { background: var(--text); color: var(--page); }

/* --- bottom tab bar --- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: rgba(30, 31, 36, .96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  height: var(--tabbar); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 11px; font-weight: 600; color: var(--faint); position: relative;
}
.tabs svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.on { color: var(--text); }
.tabs button.on[data-tab=buy] { color: var(--up); }
.tabs button.on[data-tab=short] { color: var(--down); }
.tabs button.on[data-tab=early] { color: var(--hype); }
.tabs .count { position: absolute; top: 9px; left: 55%; background: var(--hype); color: #1C1D21; font-size: 10px; border-radius: 8px; padding: 0 5px; }
@media (min-width: 900px) {
  body { padding-bottom: 30px; }
  .tabs { position: sticky; top: 64px; bottom: auto; max-width: 720px; margin: 0 auto 6px; border: 0; border-radius: 16px; background: var(--card); }
  .tabs button { height: 52px; flex-direction: row; gap: 8px; font-size: 13.5px; }
  .tabs svg { width: 18px; height: 18px; }
  .tabs .count { position: static; }
}

/* --- detail sheet --- */
.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 20; opacity: 0; pointer-events: none; transition: opacity .2s; }
.sheet-bg.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 92vh; overflow-y: auto;
  background: var(--page); border-radius: 22px 22px 0 0; padding: 10px 18px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}
.sheet.on { transform: none; }
.sheet .grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 12px; }
@media (min-width: 900px) {
  .sheet { left: auto; top: 0; width: 520px; max-height: none; border-radius: 22px 0 0 22px; transform: translateX(105%); }
  .sheet .grip { display: none; }
}
.close { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 50%; background: var(--card); font-size: 18px; color: var(--muted); }
.reason { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; }
.reason:first-child { border-top: 0; }
.reason .test { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.reason .test .bar { flex: 1; max-width: 160px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 16px; border-radius: 12px; background: var(--card); font-weight: 600; font-size: 14px; color: var(--text); }
.btn.full { width: 100%; }
.fine { font-size: 12px; color: var(--faint); margin-top: 14px; }

/* --- charts --- */
.chart { position: relative; margin-top: 10px; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.tip {
  position: absolute; top: 0; pointer-events: none; background: var(--card-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 8px; font-size: 12px; white-space: nowrap; transform: translateX(-50%); display: none;
}
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 14px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: 0; }

/* --- login page --- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login form { width: 100%; max-width: 360px; }
.login h1 { font-size: 28px; }
.login input {
  width: 100%; margin-top: 18px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-size: 16px; outline: none;
}
.login input:focus { border-color: var(--hype); }
.login button { width: 100%; margin-top: 12px; padding: 14px; border-radius: 14px; background: var(--up); color: #10221A; font-weight: 700; font-size: 16px; }
.login .err { color: var(--down); font-size: 14px; margin-top: 10px; min-height: 20px; }
@media (min-width: 900px) {
  .hero .chart { max-width: 720px; }
  .hero .range-note, .hero .proof { max-width: 720px; }
}
