:root {
  --bg: #0a1120; --bg2: #0e172b; --card: #111c33; --card2: #15213b;
  --line: rgba(148, 170, 210, .14); --line2: rgba(148, 170, 210, .24);
  --text: #e8eefb; --muted: #9eabc4; --dim: #7f8ca6;
  --accent: #7cb2ff; --up: #4ade80; --down: #ff8a8a;
  --radius: 16px; --tap: 48px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--text); font: 16px/1.5 Inter, system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #142447 0%, transparent 60%), var(--bg);
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--card); padding: .5rem 1rem; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); margin: 0; }
.meta { color: var(--dim); font-size: .8rem; margin: .75rem 0 0; }
.meta a { color: var(--muted); }

.bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 1rem;
  padding: .6rem max(1rem, env(safe-area-inset-left)); padding-top: max(.6rem, env(safe-area-inset-top));
  background: rgba(10, 17, 32, .82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.home { color: var(--muted); text-decoration: none; font-size: .9rem; min-height: var(--tap); display: inline-flex; align-items: center; }
.home:hover { color: var(--text); }
.brand { font-weight: 600; letter-spacing: .02em; margin-right: auto; }

main { max-width: 1040px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
h1 { font-size: 1.5rem; margin: 0; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1rem; margin: 0 0 .75rem; font-weight: 600; }
.card { background: linear-gradient(180deg, var(--card), var(--bg2)); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.view { animation: fade .25s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

button.primary, button.ghost, button.danger { min-height: var(--tap); padding: 0 1.2rem; border-radius: 12px; cursor: pointer; border: 1px solid transparent; font-weight: 600; transition: background .15s, border-color .15s; }
button.primary { background: var(--accent); color: #06122a; }
button.primary:hover { background: #9cc4ff; }
button.primary[disabled] { opacity: .6; cursor: wait; }
button.ghost { background: transparent; border-color: var(--line2); color: var(--text); }
button.ghost:hover { background: var(--card2); }
button.small { min-height: 40px; padding: 0 .9rem; font-weight: 500; font-size: .9rem; }
button.danger { background: transparent; border-color: rgba(255, 138, 138, .35); color: var(--down); margin-top: 1rem; width: 100%; }
button.danger:hover { background: rgba(255, 138, 138, .08); }

input[type=password], input[type=number], input[type=search], textarea {
  width: 100%; min-height: var(--tap); background: var(--bg); border: 1px solid var(--line2); border-radius: 12px; padding: .7rem .9rem; outline: none; transition: border-color .15s;
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; line-height: 1.5; }
label { display: block; font-size: .85rem; color: var(--muted); margin: .9rem 0 .35rem; }

/* login */
.login { max-width: 380px; margin: 12vh auto 0; }
.login h1 { margin-bottom: .25rem; }
.login button { width: 100%; margin-top: .5rem; }
.err { color: var(--down); min-height: 1.4em; margin: .5rem 0 0; font-size: .9rem; }

/* search */
.search { position: relative; margin-bottom: 1.5rem; }
.search svg { position: absolute; left: 1rem; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); fill: none; stroke: var(--dim); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search input { padding-left: 2.8rem; min-height: 56px; font-size: 1rem; background: var(--card); border-radius: 14px; }
#results { position: absolute; z-index: 4; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: .35rem; list-style: none; background: var(--card2); border: 1px solid var(--line2); border-radius: 14px; box-shadow: 0 18px 40px rgba(0, 0, 0, .45); max-height: 60vh; overflow: auto; }
#results li { display: flex; align-items: center; gap: .9rem; min-height: var(--tap); padding: .55rem .75rem; border-radius: 10px; cursor: pointer; }
#results li[aria-selected=true], #results li:hover { background: rgba(124, 178, 255, .12); }
#results .sym { font-family: var(--mono); font-weight: 500; min-width: 4.5rem; }
#results .nm { color: var(--muted); font-size: .9rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#results .add { color: var(--accent); font-size: .85rem; }
#results .info { color: var(--muted); cursor: default; }

/* list */
.list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .9rem; }
.count { color: var(--dim); font-weight: 500; font-size: 1rem; }
.sort { display: flex; gap: .25rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .25rem; }
.sort button { min-height: 40px; padding: 0 .8rem; border-radius: 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: .88rem; }
.sort button[aria-pressed=true] { background: var(--card2); color: var(--text); }
.sort button[data-dir=asc]::after { content: " ↑"; } .sort button[data-dir=desc]::after { content: " ↓"; }

.rows { display: grid; gap: .6rem; }
.row {
  display: grid; grid-template-columns: 1fr auto; gap: .25rem 1rem; align-items: center; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.1rem; cursor: pointer; min-height: 72px;
  transition: border-color .15s, transform .15s, background .15s;
}
.row:hover { border-color: var(--line2); background: var(--card2); }
.row:active { transform: scale(.995); }
.row .sym { font-family: var(--mono); font-weight: 500; font-size: 1.05rem; }
.row .nm { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .px { font-family: var(--mono); font-size: 1.05rem; text-align: right; }
.row .chg { font-family: var(--mono); font-size: .85rem; text-align: right; }
.row .left { grid-column: 1; grid-row: 1 / span 2; min-width: 0; }
.row .px { grid-column: 2; grid-row: 1; }
.row .chg { grid-column: 2; grid-row: 2; }
.row .tg { grid-column: 1 / -1; font-size: .8rem; color: var(--dim); }
.row .tg:empty { display: none; }
@media (min-width: 760px) {
  .row { grid-template-columns: minmax(0, 2.2fr) 1fr 1.4fr 1fr; }
  .row .left { grid-column: 1; grid-row: 1; } .row .px { grid-column: 2; grid-row: 1; } .row .chg { grid-column: 3; grid-row: 1; font-size: .95rem; } .row .tg { grid-column: 4; grid-row: 1; text-align: right; }
  .row .tg:empty { display: block; }
}
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--muted); }

.empty { text-align: center; padding: 3rem 1.5rem; border: 1px dashed var(--line2); border-radius: var(--radius); color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 1.1rem; margin-bottom: .35rem; }
.error-box { border: 1px solid rgba(255, 138, 138, .35); background: rgba(255, 138, 138, .06); border-radius: 14px; padding: 1rem 1.1rem; color: var(--text); display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.skel { height: 72px; border-radius: 14px; background: linear-gradient(90deg, var(--card) 0%, var(--card2) 50%, var(--card) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* detail */
.back { margin-bottom: 1rem; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.detail-head h1 { font-family: var(--mono); font-weight: 500; font-size: 1.9rem; }
.dprice { text-align: left; }
@media (min-width: 600px) { .dprice { text-align: right; } }
.dprice .big { font-family: var(--mono); font-size: 2rem; line-height: 1.1; }
.dprice #dChange { font-family: var(--mono); }
.chart-card { margin-top: 1rem; padding: 1rem; }
.ranges { display: flex; gap: .2rem; margin-bottom: .75rem; }
.ranges button { flex: 1; min-height: 44px; min-width: 0; padding: 0 .2rem; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-family: var(--mono); font-size: .85rem; }
.ranges button[aria-pressed=true] { background: var(--card2); border-color: var(--line2); color: var(--text); }
.chart { height: 300px; position: relative; }
@media (min-width: 760px) { .chart { height: 380px; } }
.chart .overlay { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 1rem; z-index: 3; }
.grid2 { display: grid; gap: 1rem; margin-top: 1rem; }
@media (min-width: 900px) { .grid2 { grid-template-columns: 1fr 1.4fr; align-items: start; } }
.target-row { display: flex; gap: .75rem; align-items: center; }
.target-row input { max-width: 12rem; }
.saved { color: var(--dim); font-size: .8rem; min-height: 1.2em; margin: .5rem 0 0; }

/* briefing */
.briefing h2 { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.briefing h2 small { color: var(--dim); font-weight: 400; font-size: .8rem; }
.bsec { border-top: 1px solid var(--line); padding-top: .9rem; margin-top: .9rem; }
.badge { display: inline-block; font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: .2rem .55rem; border-radius: 999px; margin-bottom: .6rem; }
.b-calc { background: rgba(124, 178, 255, .14); color: #a9cbff; }
.b-src { background: rgba(74, 222, 128, .12); color: #8ee6ad; }
.b-ai { background: rgba(196, 160, 255, .14); color: #d2bcff; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; margin: 0 0 .75rem; }
.kv div { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; }
.kv dt { font-size: .72rem; color: var(--dim); }
.kv dd { margin: 0; font-family: var(--mono); font-size: .95rem; }
.signals { margin: 0; padding: 0; list-style: none; display: grid; gap: .5rem; }
.signals li { font-size: .92rem; color: var(--text); padding-left: 1rem; position: relative; }
.signals li::before { content: ""; position: absolute; left: 0; top: .6em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.signals b { font-weight: 600; }
.news { margin: 0; padding: 0; list-style: none; display: grid; gap: .65rem; }
.news a { color: var(--text); text-decoration: none; font-weight: 500; }
.news a:hover { text-decoration: underline; }
.news span { display: block; color: var(--dim); font-size: .78rem; }
.watch { margin: .25rem 0 0; padding-left: 1.1rem; }
.watch li { margin-bottom: .35rem; }
.disclaimer { font-size: .78rem; color: var(--dim); margin-top: 1rem; }

.toast { position: fixed; left: 50%; bottom: max(1.25rem, env(safe-area-inset-bottom)); transform: translate(-50%, 140%); background: var(--card2); border: 1px solid var(--line2); color: var(--text); padding: .75rem 1.1rem; border-radius: 12px; box-shadow: 0 12px 30px rgba(0, 0, 0, .4); transition: transform .25s ease, visibility .25s; z-index: 20; max-width: calc(100% - 2rem); visibility: hidden; }
.toast.show { transform: translate(-50%, 0); visibility: visible; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* tabs */
.tabs { display: flex; gap: .25rem; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .3rem; margin-bottom: 1.25rem; }
.tabs a { flex: 1; text-align: center; min-height: 44px; display: grid; place-items: center; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem; }
.tabs a[aria-current=page] { background: var(--card2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line2); }

/* scanner */
.switch { display: inline-flex; align-items: center; gap: .6rem; margin: 0; min-height: 44px; cursor: pointer; color: var(--text); font-size: .92rem; }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); }
.scan-meta { display: flex; flex-wrap: wrap; gap: .35rem 1rem; color: var(--dim); font-size: .8rem; margin-bottom: 1rem; align-items: center; }
.scan-meta a { color: var(--muted); }
.scan-meta b { color: var(--text); font-weight: 600; }
.pill { background: rgba(255, 196, 92, .12); color: #ffd38a; border-radius: 999px; padding: .2rem .6rem; font-weight: 600; font-size: .72rem; letter-spacing: .03em; }
.past select { margin-left: .4rem; min-height: 36px; background: var(--card); color: var(--text); border: 1px solid var(--line2); border-radius: 8px; padding: 0 .5rem; }
.scan-grid { display: grid; gap: 1rem; }
@media (min-width: 1000px) { .scan-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.scan-card { padding: 1.1rem; }
.small { font-size: .82rem; }
.scan-list { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .55rem; }
.scan-row { display: grid; grid-template-columns: 1.6rem 1fr auto; gap: .2rem .75rem; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: .8rem .9rem; }
.scan-row .rank { color: var(--dim); font-family: var(--mono); font-size: .85rem; }
.scan-row .sym { font-family: var(--mono); font-weight: 500; }
.scan-row .nm { color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-row .who { min-width: 0; }
.scan-row .px { font-family: var(--mono); text-align: right; font-size: .95rem; }
.scan-row .px div { font-size: .82rem; }
.scan-row .stats { grid-column: 2 / -1; display: flex; gap: 1rem; margin: .35rem 0 0; flex-wrap: wrap; }
.scan-row .stats dt { font-size: .7rem; color: var(--dim); }
.scan-row .stats dd { margin: 0; font-family: var(--mono); font-size: .88rem; }
.scan-row .stats dd.hl { color: var(--accent); }
.scan-actions { grid-column: 2 / -1; display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; margin-top: .35rem; flex-wrap: wrap; }
.scan-actions details { flex: 1; min-width: 12rem; }
.scan-actions summary { cursor: pointer; color: var(--accent); font-size: .85rem; min-height: 36px; display: flex; align-items: center; }
.scan-actions .news { margin-top: .4rem; }
.scan-actions .news a { font-size: .88rem; }
.watch-btn[disabled] { opacity: .55; cursor: default; }
.method { margin-top: 1rem; }
.method summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.method p { color: var(--muted); font-size: .9rem; }
.method b { color: var(--text); }
/* trade ideas */
.tabs a { font-size: .9rem; padding: 0 .25rem; }
.sec-title { font-size: 1.15rem; margin: 1.6rem 0 .75rem; }
#ideasBody > .card, #ideasBody > .error-box { margin-bottom: 1rem; }
.card h2 small { font-weight: 400; font-size: .8rem; }
h3.sub { font-size: .9rem; color: var(--muted); font-weight: 600; margin: 1.1rem 0 .5rem; }
.tiny { font-size: .72rem; }
.regime { font-weight: 700; text-transform: capitalize; padding: .1rem .5rem; border-radius: 6px; }
.r-uptrend { color: var(--up); background: rgba(74, 222, 128, .1); } .r-downtrend { color: var(--down); background: rgba(255, 138, 138, .1); } .r-mixed, .r-unknown { color: #ffd38a; background: rgba(255, 196, 92, .1); }
table.mini { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.mini th, table.mini td { padding: .45rem .4rem; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.mini th:first-child, table.mini td:first-child { text-align: left; }
table.mini thead th { color: var(--dim); font-weight: 500; font-size: .75rem; }
table.mini td { font-family: var(--mono); }
.tbl-wrap { overflow-x: auto; margin-top: .75rem; }
table.rec td, table.rec th { text-align: left; }
.bars { display: grid; gap: .35rem; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1.3fr) 1fr 4.2rem; align-items: center; gap: .6rem; font-size: .85rem; }
.bl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt { position: relative; height: 10px; background: var(--bg); border-radius: 5px; }
.bt::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--line2); }
.bf { position: absolute; top: 0; bottom: 0; border-radius: 5px; }
.bf.pos { background: var(--up); } .bf.neg { background: var(--down); }
.bv { font-family: var(--mono); text-align: right; font-size: .82rem; }
.idea { margin-bottom: 1rem; }
.idea-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: .75rem; }
.idea-head .right { text-align: right; }
.idea-sym { font-family: var(--mono); font-size: 1.3rem; font-weight: 500; display: flex; gap: .5rem; align-items: center; }
.idea-head .px { font-family: var(--mono); margin-top: .35rem; }
.st { display: inline-block; font-size: .75rem; font-weight: 700; padding: .25rem .6rem; border-radius: 999px; }
.st-go { background: rgba(74, 222, 128, .15); color: #8ee6ad; } .st-watch { background: rgba(255, 196, 92, .14); color: #ffd38a; } .st-none { background: rgba(148, 170, 210, .14); color: var(--muted); }
.side { font-family: Inter, sans-serif; font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: .15rem .45rem; border-radius: 6px; }
.side.long { background: rgba(74, 222, 128, .15); color: var(--up); } .side.short { background: rgba(255, 138, 138, .15); color: var(--down); }
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .5rem; margin: 0 0 .75rem; }
.levels div { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .5rem .7rem; }
.levels dt { font-size: .72rem; color: var(--dim); } .levels dd { margin: 0; font-family: var(--mono); font-size: 1rem; }
.note { background: rgba(255, 196, 92, .08); border-left: 3px solid #ffd38a; padding: .5rem .75rem; border-radius: 6px; font-size: .88rem; margin: 0 0 .6rem; }
.idea details { border-top: 1px solid var(--line); padding: .6rem 0 0; margin-top: .6rem; }
.idea details > summary, details.bsec > summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; gap: .5rem; font-weight: 500; font-size: .92rem; }
.idea details .badge { margin: 0; }
.idea-chart { height: 280px; margin: .75rem 0; position: relative; }
.chart-btn { margin-top: .25rem; }
.al { text-transform: capitalize; } .al-agree { color: var(--up); } .al-conflict { color: var(--down); } .al-mixed { color: #ffd38a; }
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.alerts li { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .75rem; }
.alerts pre { white-space: pre-wrap; margin: .25rem 0 0; font: inherit; font-size: .88rem; }