:root {
  --bg: #f4f6fa; --card: #ffffff; --ink: #0f1b2d; --muted: #5d6b82; --line: #e3e8f0;
  --brand: #0b1f3a; --accent: #f5a623; --up: #0a8f5b; --down: #d23f3f; --flat: #8792a6;
  --up-bg: #e3f6ee; --down-bg: #fdeaea; --flat-bg: #eef1f6; --shadow: 0 1px 3px rgba(15, 27, 45, .08);
  --font: "Inter", "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1220; --card: #111c2e; --ink: #e8eef8; --muted: #93a1b8; --line: #1f2d44;
    --up: #2ecf8a; --down: #ff6b6b; --up-bg: #0f2e24; --down-bg: #361a1d; --flat-bg: #1a2638; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1220; --card: #111c2e; --ink: #e8eef8; --muted: #93a1b8; --line: #1f2d44;
  --up: #2ecf8a; --down: #ff6b6b; --up-bg: #0f2e24; --down-bg: #361a1d; --flat-bg: #1a2638; --shadow: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5;
  padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--brand); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { border-radius: 8px; flex: none; }
.name { font-weight: 700; font-size: 18px; letter-spacing: .2px; }
.name .dev { color: var(--accent); font-weight: 600; font-size: 15px; margin-left: 4px; }
.tag { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions { display: flex; gap: 8px; align-items: center; flex: none; }
select { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .1); color: #fff; max-width: 130px; }
select option { color: #000; }
.icon-btn { background: rgba(255, 255, 255, .1); color: #fff; border: 1px solid rgba(255, 255, 255, .25); border-radius: 8px;
  width: 34px; height: 34px; font-size: 16px; cursor: pointer; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { background: none; border: 0; padding: 8px 4px; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tabs button span { font-size: 18px; }
.tabs button.on { color: var(--ink); }
.tabs button.on b { border-bottom: 2px solid var(--accent); }
.tabs b { font-weight: 600; }
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .tabs { position: sticky; top: 54px; bottom: auto; display: flex; justify-content: center; gap: 8px; border: 0;
    border-bottom: 1px solid var(--line); }
  .tabs button { flex-direction: row; font-size: 14px; padding: 10px 16px; }
  .tabs button span { font-size: 15px; }
}

main { max-width: 1180px; margin: 0 auto; padding: 16px; }
.view { display: none; }
.view.on { display: block; }
.grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid.two { grid-template-columns: 1.05fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { font-size: 15px; margin: 0 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card h2 small { font-weight: 400; color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* sentiment */
.mood { display: grid; grid-template-columns: 170px 1fr; gap: 14px; align-items: center; }
@media (max-width: 420px) { .mood { grid-template-columns: 1fr; justify-items: center; text-align: center; } }
.gauge-label { font-size: 22px; font-weight: 700; margin: 0; }
.gauge-score { font-size: 13px; color: var(--muted); }
.parts { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 13px; margin-top: 8px; width: 100%; }
.parts .p { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* tickers */
.cue-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; scrollbar-width: none; }
.chip { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 4px 11px; font: inherit;
  font-size: 13px; white-space: nowrap; cursor: pointer; }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
:root[data-theme="dark"] .chip.on { background: var(--accent); color: #111; border-color: var(--accent); }
.tickers { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tk { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.tk .n { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.chg { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--flat); }

/* sectors */
.sectors { display: flex; flex-wrap: wrap; gap: 6px; }
.sec { border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 500; }
.sec.pos { background: var(--up-bg); color: var(--up); }
.sec.neg { background: var(--down-bg); color: var(--down); }

/* brief */
.brief { margin: 0; padding-left: 18px; }
.brief li { margin: 4px 0; }

/* news */
.news-list { list-style: none; margin: 0; padding: 0; }
.ni { padding: 10px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 6px 1fr; gap: 10px; }
.ni:first-child { border-top: 0; }
.bar { border-radius: 3px; background: var(--flat-bg); }
.bar.pos { background: var(--up); } .bar.neg { background: var(--down); }
.ni .t { font-weight: 600; text-decoration: none; display: block; }
.ni .t:hover { text-decoration: underline; }
.ni .why { font-size: 13px; color: var(--ink); opacity: .85; margin-top: 3px; }
.ni .meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; align-items: center; }
.pill { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; }
.pill.pos { background: var(--up-bg); color: var(--up); } .pill.neg { background: var(--down-bg); color: var(--down); }
.pill.off { background: var(--flat-bg); color: var(--muted); }
.stk { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--flat-bg); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }

/* events */
.ev { display: grid; grid-template-columns: 54px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); align-items: center; }
.ev:first-child { border-top: 0; }
.date { text-align: center; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); padding: 4px 0; line-height: 1.15; }
.date .d { font-size: 18px; font-weight: 700; }
.date .m { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.imp3 .date { border-color: var(--accent); }
.flag { font-size: 11px; color: var(--muted); }
.hol.past { opacity: .45; }

/* stocks */
.stock { padding: 10px 0; border-top: 1px solid var(--line); }
.stock:first-child { border-top: 0; }
.stock .hd { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.stock .sym { font-weight: 700; }
.stock ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }

.pro { background: linear-gradient(120deg, #0b1f3a, #183a6b); color: #fff; border: 0; }
.pro b { color: var(--accent); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--flat); }
.dot.on { background: var(--up); }

.foot { max-width: 1180px; margin: 0 auto; padding: 4px 16px 24px; color: var(--muted); font-size: 12px; }
.foot .credits a { color: var(--muted); }
.skeleton { color: var(--muted); padding: 20px 0; text-align: center; }
[dir="rtl"] .brief, [dir="rtl"] .stock ul { padding-left: 0; padding-right: 18px; }
[dir="rtl"] .parts .p { text-align: left; }

/* watchlist, stock search and single-stock page */
.wrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0;
  border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.wrow:first-child { border-top: 0; }
.wrow:hover b { text-decoration: underline; }
.wrow > span:last-child { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.star { background: none; border: 0; font-size: 20px; line-height: 1; cursor: pointer; color: var(--flat); padding: 2px 4px; }
.star.on { color: var(--accent); }
.search { width: 100%; font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); margin-bottom: 6px; }
.all-list { max-height: 420px; overflow-y: auto; }
a.sym { color: inherit; }
.stock-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.stock-head h1 { margin: 0; font-size: 26px; display: flex; align-items: center; gap: 6px; }
.stock-head .price { text-align: right; }
.stock-head .price .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
[dir="rtl"] .stock-head .price { text-align: left; }
@media (max-width: 420px) { .name .dev { display: none; } .top { padding: 10px 12px; } }
.ni .meta a.tr { color: var(--ink); font-weight: 600; text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; }
.ni .meta a.tr:hover { background: var(--flat-bg); }
