/* Meshal Stocks — design system (RTL, mobile first). Calm neutrals, one brand accent, soft signal colours.
   Light and dark are tuned separately: dark uses blue-grey surfaces (not black) and desaturated accents for long sessions. */
:root {
  --bg: #eaf5ee; --bg2: #dfeee5; --card: #ffffff; --card2: #f5faf7; --line: #dbe9e0; --line2: #c7dacd;
  --text: #18202b; --muted: #5b6676; --faint: #8f99a8;
  --brand: #0f9d6e; --brand-ink: #ffffff; --brand-soft: #e2f4ec;
  --green: #13945f; --green2: #0e7a4e; --green-soft: #e3f4ec; --red: #d64545; --red-soft: #fbeaea;
  --blue: #2e6be6; --blue-soft: #e7eefc; --purple: #7c5ce0; --purple-soft: #efeafd;
  --amber: #b77d05; --amber-soft: #fbf3df; --orange: #d0631b; --orange-soft: #fcebdf; --gray-soft: #e8f1eb;
  --sig-b: #2e6be6; --sig-b-soft: #e7eefc; --sig-t: #d64545; --sig-t-soft: #fbeaea;
  --shadow: 0 1px 2px rgba(20, 32, 52, .04), 0 4px 14px rgba(20, 32, 52, .05);
  --shadow-lg: 0 10px 40px rgba(20, 32, 52, .14);
  --ring: color-mix(in srgb, var(--brand) 35%, transparent);
  --radius: 16px; --radius-sm: 11px; --nav-h: 66px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e1217; --bg2: #12171d; --card: #161c23; --card2: #1b222b; --line: #242c36; --line2: #2f3945;
  --text: #e4e8ee; --muted: #98a2b1; --faint: #6b7586;
  --brand: #34c58a; --brand-ink: #062016; --brand-soft: #14302a;
  --green: #3cc88a; --green2: #2fae76; --green-soft: #15302a; --red: #ef7a7a; --red-soft: #361f24;
  --blue: #6c9cff; --blue-soft: #1a2843; --purple: #a58bff; --purple-soft: #29244a;
  --amber: #e2b04a; --amber-soft: #342b17; --orange: #ef9a5c; --orange-soft: #3a2618; --gray-soft: #1e2630;
  --sig-b: #79a6ff; --sig-b-soft: #1b2a47; --sig-t: #f08585; --sig-t-soft: #3a2027;
  --shadow: 0 1px 0 rgba(255, 255, 255, .02) inset, 0 1px 2px rgba(0, 0, 0, .25);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0e1217; --bg2: #12171d; --card: #161c23; --card2: #1b222b; --line: #242c36; --line2: #2f3945;
    --text: #e4e8ee; --muted: #98a2b1; --faint: #6b7586;
    --brand: #34c58a; --brand-ink: #062016; --brand-soft: #14302a;
    --green: #3cc88a; --green2: #2fae76; --green-soft: #15302a; --red: #ef7a7a; --red-soft: #361f24;
    --blue: #6c9cff; --blue-soft: #1a2843; --purple: #a58bff; --purple-soft: #29244a;
    --amber: #e2b04a; --amber-soft: #342b17; --orange: #ef9a5c; --orange-soft: #3a2618; --gray-soft: #1e2630;
    --sig-b: #79a6ff; --sig-b-soft: #1b2a47; --sig-t: #f08585; --sig-t-soft: #3a2027;
    --shadow: 0 1px 0 rgba(255, 255, 255, .02) inset, 0 1px 2px rgba(0, 0, 0, .25);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--font, "IBM Plex Sans Arabic"), -apple-system, "SF Arabic", system-ui, sans-serif;
  font-size: calc(15px * var(--fs, 1)); line-height: 1.55; min-height: 100dvh; padding-top: env(safe-area-inset-top);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background-color .25s ease, color .25s ease;
}
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; letter-spacing: -.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 8px; }
::selection { background: color-mix(in srgb, var(--brand) 25%, transparent); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  max-width: 720px; margin: 0 auto; padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.5) blur(14px); -webkit-backdrop-filter: saturate(1.5) blur(14px);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: calc(18px * var(--fs, 1)); direction: ltr; letter-spacing: -.01em; }
.brand svg { width: 30px; height: 30px; }
.top-actions { display: flex; gap: 8px; }
.icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); display: grid; place-items: center; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--line2); }
.icon-btn svg { width: 20px; height: 20px; }
.badge {
  position: absolute; top: -4px; left: -4px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  background: var(--red); color: #fff; font-size: calc(10.5px * var(--fs, 1)); font-weight: 700; display: grid; place-items: center;
  box-shadow: 0 0 0 2px var(--bg);
}

main { max-width: 720px; margin: 0 auto; padding: 6px 16px calc(var(--nav-h) + 30px + env(safe-area-inset-bottom)); }
.page-title { margin: 10px 2px 2px; font-size: calc(25px * var(--fs, 1)); font-weight: 700; letter-spacing: -.015em; }
.page-sub { color: var(--muted); margin: 0 2px 16px; font-size: calc(13.5px * var(--fs, 1)); }
h2.section { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: calc(16px * var(--fs, 1)); font-weight: 700; margin: 22px 2px 10px; }
h2.section a, .link { font-size: calc(13px * var(--fs, 1)); font-weight: 600; color: var(--blue); cursor: pointer; }

/* ---------- surfaces ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.card + .card, .card + details.card, details.card + .card { margin-top: 10px; }
details.card summary { list-style: none; display: flex; align-items: center; gap: 8px; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after { content: ""; margin-inline-start: auto; width: 8px; height: 8px; border: solid var(--faint); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .2s; }
details.card[open] summary::after { transform: rotate(-135deg); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 + .grid2, .card + .grid2, .grid2 + .card { margin-top: 10px; }

/* stat tiles (home) */
.stat-tile { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; margin: 0 !important; transition: transform .15s, border-color .15s; }
.stat-tile:active { transform: scale(.985); }
.stat-tile[data-go]:hover { border-color: var(--line2); }
.stat-tile .num { font-size: calc(30px * var(--fs, 1)) !important; line-height: 1.15; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; cursor: pointer; }
.tile .row1 { display: flex; justify-content: space-between; align-items: center; }
.tile .label { font-size: calc(13px * var(--fs, 1)); font-weight: 600; }
.tile .value { font-size: calc(22px * var(--fs, 1)); font-weight: 700; }
.tile .hint { font-size: calc(11.5px * var(--fs, 1)); color: var(--muted); }
.ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.ic svg { width: 20px; height: 20px; }
.ic.green { background: var(--green-soft); color: var(--green); }
.ic.blue { background: var(--blue-soft); color: var(--blue); }
.ic.purple { background: var(--purple-soft); color: var(--purple); }
.ic.amber { background: var(--amber-soft); color: var(--amber); }
.tile.t-green .label { color: var(--green); } .tile.t-blue .label { color: var(--blue); }
.tile.t-purple .label { color: var(--purple); }
.tile.t-purple { background: linear-gradient(160deg, var(--purple-soft), var(--card) 70%); }

.up { color: var(--green); } .down { color: var(--red); } .muted { color: var(--muted); } .faint { color: var(--faint); }
.small { font-size: calc(12.5px * var(--fs, 1)); } .tiny { font-size: calc(11.5px * var(--fs, 1)); }
.bold { font-weight: 700; }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px; font-size: calc(12.5px * var(--fs, 1)); font-weight: 600;
  white-space: nowrap; background: var(--gray-soft); color: var(--muted); border: 1px solid transparent; line-height: 1.5;
}
button.chip { cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
button.chip:hover { color: var(--text); border-color: var(--line2); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.st-watch { background: var(--amber-soft); color: var(--amber); }
.st-ready { background: var(--brand-soft) !important; color: var(--brand) !important; border-color: color-mix(in srgb, var(--brand) 25%, transparent) !important; }
.st-active { background: var(--sig-b-soft); color: var(--sig-b); }
.st-target_hit { background: var(--green-soft); color: var(--green2); }
.st-stopped { background: var(--sig-t-soft); color: var(--sig-t); }
.st-expired { background: var(--gray-soft); color: var(--muted); }
.st-tracking_ended { background: var(--orange-soft); color: var(--orange); }
.st-cancelled { background: var(--gray-soft); color: var(--faint); }
.st-data_unreliable { background: var(--amber-soft); color: var(--orange); }
.mock-tag { background: var(--amber-soft); color: var(--amber); font-size: calc(11px * var(--fs, 1)); padding: 2px 8px; border-radius: 6px; font-weight: 700; }

/* signals: soft fills, strong text — readable in both themes */
.sig-b { background: var(--sig-b-soft) !important; color: var(--sig-b) !important; }
.sig-t { background: var(--sig-t-soft) !important; color: var(--sig-t) !important; }
.chip.sig-mini { padding: 0 7px; font-size: calc(10.5px * var(--fs, 1)); margin: 2px 0 0 3px; font-weight: 700; }
.list-item.sig-row { position: relative; padding-inline-start: 12px; }
.list-item.sig-row::before { content: ""; position: absolute; inset-inline-start: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--sig-color, var(--sig-b)); }
.list-item.sig-row.b { --sig-color: var(--sig-b); } .list-item.sig-row.t { --sig-color: var(--sig-t); }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: 13px; font-size: calc(13px * var(--fs, 1)); margin-bottom: 12px; line-height: 1.6; }
.banner.warn { background: var(--amber-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--amber) 28%, transparent); }
.banner.err { background: var(--red-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--red) 28%, transparent); }

/* ---------- stock rows ---------- */
.rec-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sym { display: flex; align-items: center; gap: 11px; min-width: 0; }
.logo, .sym .logo {
  width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: var(--card2); border: 1px solid var(--line); color: var(--muted);
  font-weight: 700; font-size: calc(10.5px * var(--fs, 1)); letter-spacing: -.01em; direction: ltr; overflow: hidden; text-overflow: clip; white-space: nowrap;
}
.sym .n { font-weight: 700; font-size: calc(18px * var(--fs, 1)); letter-spacing: -.01em; } .sym .s { font-size: calc(12px * var(--fs, 1)); color: var(--muted); }
.rec-body { display: grid; grid-template-columns: 128px 1fr; gap: 14px; align-items: center; margin-top: 12px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 10px; font-size: calc(14px * var(--fs, 1)); }
.kv .k { color: var(--muted); } .kv .v { text-align: left; font-weight: 600; }
.kv .v.buy { color: var(--green); }
.ring { position: relative; width: 120px; height: 120px; margin: auto; }
.ring svg { width: 120px; height: 120px; transform: rotate(-90deg); }
.ring .c { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .p { font-size: calc(25px * var(--fs, 1)); font-weight: 700; }
.ring-label { text-align: center; font-weight: 600; font-size: calc(13px * var(--fs, 1)); margin-top: 4px; }

.list-item {
  display: flex; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer;
  border-radius: 10px; transition: background .12s;
}
.list-item:last-child { border-bottom: 0; }
.list-item[data-go]:hover { background: var(--card2); }
.list-item[data-go]:active { background: var(--gray-soft); }
.list-item .bold { font-weight: 650; }
.progress { height: 6px; border-radius: 3px; background: var(--gray-soft); overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; background: var(--green); border-radius: 3px; }
.progress.neg > i { background: var(--red); }

/* ---------- buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 13px; background: var(--brand); color: var(--brand-ink);
  font-weight: 700; font-size: calc(15px * var(--fs, 1)); cursor: pointer; margin-top: 14px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset, 0 4px 14px color-mix(in srgb, var(--brand) 22%, transparent);
  transition: transform .1s, filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: scale(.985); }
.btn.secondary { background: var(--card); color: var(--text); border-color: var(--line2); box-shadow: none; }
.btn.secondary:hover { background: var(--card2); filter: none; }
.btn.danger { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, transparent); box-shadow: none; }
.btn.sm { min-height: 34px; font-size: calc(13px * var(--fs, 1)); width: auto; padding: 0 12px; margin: 0; border-radius: 10px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg { width: 19px; height: 19px; flex: none; }
.grid2 > .btn, .grid2 > div > .btn { margin-top: 0; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; } .grow { flex: 1; }

/* ---------- segmented & forms ---------- */
.seg { display: flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1; min-height: 34px; border: 0; background: transparent; border-radius: 9px; font-weight: 600; font-size: calc(13px * var(--fs, 1)); color: var(--muted); cursor: pointer; white-space: nowrap; padding: 0 12px; transition: background .15s, color .15s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
label.f { display: block; font-size: calc(12.5px * var(--fs, 1)); font-weight: 600; color: var(--muted); margin: 12px 2px 5px; }
input.in, select.in, textarea.in {
  width: 100%; min-height: 46px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card);
  padding: 0 13px; font-size: max(16px, calc(16px * var(--fs, 1))); transition: border-color .15s, box-shadow .15s; margin: 0;
}
textarea.in { padding: 10px 13px; line-height: 1.5; }
input.in::placeholder, textarea.in::placeholder { color: var(--faint); }
input.in:focus, select.in:focus, textarea.in:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
input[type="checkbox"] { accent-color: var(--brand); }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line2); border-radius: 15px; transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { right: 23px; }
.set-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row .t { flex: 1; } .set-row .t div:last-child { font-size: calc(12px * var(--fs, 1)); color: var(--muted); }

/* ---------- tables ---------- */
table.t { width: 100%; border-collapse: collapse; font-size: calc(13.5px * var(--fs, 1)); }
table.t th { font-weight: 600; color: var(--muted); font-size: calc(11.5px * var(--fs, 1)); padding: 8px 6px; border-bottom: 1px solid var(--line); background: var(--card2); position: sticky; top: 0; }
table.t td { padding: 9px 6px; border-bottom: 1px solid var(--line); }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td, table.t tr:hover td { background: color-mix(in srgb, var(--card2) 70%, transparent); }
.scroll-x { overflow-x: auto; }
td.num, th.num { display: table-cell; text-align: center; }
table.t td, table.t th { white-space: nowrap; }
table.t td:first-child { white-space: normal; }
table.t th { text-align: center; } table.t th:first-child { text-align: right; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 22px 14px 0; border-right: 2px solid var(--line); margin-right: 6px; }
.timeline li::before { content: ""; position: absolute; right: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 2px solid var(--brand); }
.timeline li:last-child { border-right-color: transparent; }

/* ---------- charts ---------- */
.chart { width: 100%; height: 190px; display: block; touch-action: pan-y; }
.chart text { fill: var(--faint); font-size: calc(10px * var(--fs, 1)); }
.chart .grid { stroke: var(--line); }
.chart-tip { position: absolute; background: var(--text); color: var(--bg); font-size: calc(12px * var(--fs, 1)); padding: 3px 8px; border-radius: 6px; pointer-events: none; white-space: nowrap; }
.chart-wrap { position: relative; }
.ind-chart text { fill: var(--faint); font-size: calc(10px * var(--fs, 1)); }
.lg { display: inline-block; width: 12px; height: 4px; border-radius: 2px; margin-inline-end: 4px; vertical-align: middle; }
.tradingview-widget-container { border-radius: 12px; overflow: hidden; }
.tradingview-widget-copyright { padding: 4px 6px; } .tradingview-widget-copyright a { color: var(--faint); }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; }
.stat .l { font-size: calc(11.5px * var(--fs, 1)); color: var(--muted); } .stat .v { font-weight: 700; font-size: calc(15px * var(--fs, 1)); margin-top: 1px; }
@media (min-width: 520px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }

/* scanner table */
.sc-table td.sc-cell { text-align: center; cursor: pointer; position: relative; min-width: 64px; }
.sc-table td.sc-cell.hot { background: var(--sig-b-soft); }
.sig-dot { position: absolute; top: 6px; left: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--sig-b); }

/* ---------- bottom nav ---------- */
nav.bottom {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 30; display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: saturate(1.5) blur(16px); -webkit-backdrop-filter: saturate(1.5) blur(16px);
  border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
nav.bottom a { flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: calc(11px * var(--fs, 1)); font-weight: 500; color: var(--faint); padding: 4px 0 2px; transition: color .15s; }
nav.bottom a svg { width: 23px; height: 23px; padding: 3px 14px; box-sizing: content-box; border-radius: 999px; transition: background .2s, color .2s; }
nav.bottom a:hover { color: var(--muted); }
nav.bottom a.on { color: var(--brand); font-weight: 700; }
nav.bottom a.on svg { background: var(--brand-soft); }
nav.bottom button span { font-size: calc(10.5px * var(--fs, 1)); }

/* ---------- sheets / toasts ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(8, 12, 18, .45); backdrop-filter: blur(2px); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease; }
.sheet { background: var(--card); width: 100%; max-width: 640px; border-radius: 22px 22px 0 0; padding: 10px 18px calc(20px + env(safe-area-inset-bottom)); max-height: 90dvh; overflow-y: auto; box-shadow: var(--shadow-lg); border: 1px solid var(--line); border-bottom: 0; animation: up .2s ease; }
.sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line2); margin: 0 auto 12px; }
.sheet h3 { margin: 0 0 10px; font-size: calc(18px * var(--fs, 1)); }
@keyframes fade { from { opacity: 0; } } @keyframes up { from { transform: translateY(30px); opacity: .6; } }
.toast { position: fixed; bottom: calc(var(--nav-h) + 22px + env(safe-area-inset-bottom)); inset-inline: 16px; margin: auto; max-width: 460px; z-index: 60; background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 13px; font-size: calc(14px * var(--fs, 1)); font-weight: 500; text-align: center; box-shadow: var(--shadow-lg); animation: up .2s ease; }
.empty { text-align: center; color: var(--faint); padding: 26px 10px; font-size: calc(13.5px * var(--fs, 1)); }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- login ---------- */
.login-wrap { max-width: 400px; margin: 9vh auto 0; padding: 0 20px; }
.login-wrap .brand { justify-content: center; font-size: calc(26px * var(--fs, 1)); margin-bottom: 6px; }
.login-wrap .page-sub { text-align: center; }
.login-wrap .card { padding: 6px 18px 18px; border-radius: 20px; }
.err-text { color: var(--red); font-size: calc(13px * var(--fs, 1)); margin-top: 8px; min-height: 18px; }
code.secret { display: block; direction: ltr; font-size: calc(14px * var(--fs, 1)); background: var(--card2); padding: 10px; border-radius: 10px; word-break: break-all; margin: 8px 0; }
.link { display: inline-flex; align-items: center; gap: 4px; } .link svg { width: 18px; height: 18px; }

/* wide screens: a little more room */
@media (min-width: 760px) {
  main { padding-top: 14px; }
  .page-title { font-size: calc(28px * var(--fs, 1)); }
}

/* section header with a trailing link */
.row.between:has(> h2.section) { margin: 22px 2px 10px; }
.row.between > h2.section { margin: 0; }
.dot-sig { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-inline-end: 7px; vertical-align: 1px; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
.dot-sig.b { background: var(--sig-b); color: var(--sig-b); } .dot-sig.t { background: var(--sig-t); color: var(--sig-t); }

/* RSI LinReg Bands chart */
.ind-chart { display: block; width: 100%; touch-action: pan-y; cursor: crosshair; }
.ind-chart text { font-family: inherit; }
.chart-wrap .chart-tip { background: var(--card); color: var(--text); border: 1px solid var(--line2); box-shadow: var(--shadow-lg); font-size: calc(12px * var(--fs, 1)); padding: 5px 9px; border-radius: 9px; z-index: 2; }
.ind-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 4px 0; font-size: calc(11.5px * var(--fs, 1)); color: var(--muted); }
.ind-legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg { display: inline-block; width: 16px; height: 3px; border-radius: 2px; }
.lg.dash { height: 0; border-top: 2px dashed; background: none; }

/* ---------- layout helpers ---------- */
.grid4 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cols2 { display: grid; grid-template-columns: 1fr; gap: 0 18px; }
.dot-st { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin-inline-end: 6px; }
.chip .dot { width: 7px; height: 7px; }
.tile.t-hero { background: linear-gradient(150deg, color-mix(in srgb, var(--brand) 13%, var(--card)), var(--card) 65%); border-color: color-mix(in srgb, var(--brand) 22%, var(--line)); }
.tile.t-hero .label { color: var(--brand); }

/* ---------- desktop: sidebar navigation, wider content ---------- */
@media (min-width: 1000px) {
  :root { --side: 236px; }
  body { padding-inline-start: var(--side); }
  .topbar, main { max-width: 1120px; }
  main { padding: 10px 28px 48px; }
  .topbar { padding: 14px 28px; }
  nav.bottom {
    top: 0; bottom: 0; inset-inline-start: 0; inset-inline-end: auto; width: var(--side);
    flex-direction: column; justify-content: flex-start; gap: 4px; padding: 86px 14px 24px;
    border-top: 0; border-inline-end: 1px solid var(--line); background: var(--card);
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  nav.bottom a { flex: none; max-width: none; flex-direction: row; gap: 12px; font-size: calc(14.5px * var(--fs, 1)); font-weight: 600; padding: 11px 14px; border-radius: 12px; color: var(--muted); }
  nav.bottom a svg { width: 21px; height: 21px; padding: 0; }
  nav.bottom a:hover { background: var(--card2); color: var(--text); }
  nav.bottom a.on { background: var(--brand-soft); color: var(--brand); }
  nav.bottom a.on svg { background: none; }
  .topbar .brand { display: none; }
  nav.bottom { padding-top: 22px; }
  .side-brand { display: flex !important; align-items: center; gap: 10px; direction: ltr; justify-content: flex-end; font-weight: 700; font-size: calc(18px * var(--fs, 1)); padding: 6px 10px 22px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
  .side-brand svg { width: 32px; height: 32px; }
  .side-foot { display: block !important; margin-top: auto; padding: 12px; font-size: calc(11.5px * var(--fs, 1)); color: var(--faint); border-top: 1px solid var(--line); }
  .topbar { justify-content: flex-end; }
  .grid4 { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .cols2 { grid-template-columns: 1fr 1fr; }
  .grid2 { gap: 14px; }
  .page-title { font-size: calc(30px * var(--fs, 1)); margin-top: 4px; }
  .sheet-bg { align-items: center; }
  .sheet { border-radius: 20px; border-bottom: 1px solid var(--line); max-width: 560px; }
  .toast { bottom: 28px; }
}

.side-brand, .side-foot { display: none; }

/* ---------- read-only viewers: trading and editing controls are not shown ---------- */
body.viewer [data-act="ticket"], body.viewer [data-act^="list-"]:not([data-act="list-g"]):not([data-act="list-m"]):not([data-act="list-sh"]):not([data-act="list-sigonly"]),
body.viewer [data-act^="tv-"], body.viewer [data-act="cancel-rec"], body.viewer [data-act="watch"], body.viewer [data-act="unwatch"],
body.viewer [data-go="#/scansetup"], body.viewer .admin-only, body.viewer #pending-card, body.viewer .add-card,
body.viewer [data-act="close-pos"], body.viewer [data-act="cancel-order"], body.viewer [data-act="auto-toggle"], body.viewer [data-act="reset-pf"], body.viewer [data-act="save-pf"], body.viewer [data-act="backtest"], body.viewer [data-act="fault"] { display: none !important; }

/* font picker */
.font-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 6px; }
.font-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card); cursor: pointer; text-align: start; transition: border-color .15s, background .15s; }
.font-opt:hover { border-color: var(--brand); }
.font-opt.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 2px var(--ring); }
.fo-sample { font-size: calc(17px * var(--fs, 1)); font-weight: 600; color: var(--text); }
.fo-name { font-size: 11px; color: var(--muted); font-family: var(--font, "IBM Plex Sans Arabic"), system-ui, sans-serif; }

/* timeframe filter above signal lists */
.tf-seg { margin: 0 0 8px; }
.tf-seg button { min-height: 32px; font-size: calc(12.5px * var(--fs, 1)); padding: 0 8px; }
.tf-seg .tf-n { font-size: calc(10.5px * var(--fs, 1)); color: var(--faint); margin-inline-start: 2px; }
.tf-seg button.on .tf-n { color: var(--brand); font-weight: 700; }

/* ---------- profile ---------- */
.profile-head { display: flex; align-items: center; gap: 14px; }
.avatar { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-weight: 800; font-size: calc(20px * var(--fs, 1));
  background: var(--brand-soft); color: var(--brand); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); direction: ltr; }

/* ---------- English (LTR) adjustments ---------- */
[dir="ltr"] body { font-family: var(--font, "IBM Plex Sans Arabic"), -apple-system, "Segoe UI", system-ui, sans-serif; }
[dir="ltr"] .switch span::after { right: auto; left: 3px; }
[dir="ltr"] .switch input:checked + span::after { right: auto; left: 23px; }
[dir="ltr"] table.t th:first-child, [dir="ltr"] table.t td:first-child { text-align: left; }
[dir="ltr"] [data-back] svg, [dir="ltr"] .btn svg.arrow { transform: scaleX(-1); }
[dir="ltr"] .kv .v { text-align: right; }
[dir="ltr"] .side-brand { justify-content: flex-start; }
[dir="ltr"] .timeline li { padding: 0 0 14px 22px; border-right: 0; border-left: 2px solid var(--line); margin: 0 0 0 6px; }
[dir="ltr"] .timeline li::before { right: auto; left: -7px; }
[dir="ltr"] .timeline li:last-child { border-left-color: transparent; }

/* current price on recommendation rows */
.cur-px { display: flex; align-items: baseline; gap: 8px; margin: 6px 0 4px; }
.cur-px .l { font-size: calc(12px * var(--fs, 1)); color: var(--muted); font-weight: 600; }
.cur-px .v { font-size: calc(22px * var(--fs, 1)); font-weight: 800; letter-spacing: -.01em; color: var(--text); }
.cur-px .v.up { color: var(--green); } .cur-px .v.down { color: var(--red); }
.cur-px .v small { font-size: calc(12px * var(--fs, 1)); font-weight: 600; color: var(--muted); }

/* =====================================================================================================
   v2 polish — calm & professional: softer surfaces, floating glass navigation, recommendation cards with
   a price ruler, skeleton loading, gentle motion. Components only (layout unchanged).
   ===================================================================================================== */
:root {
  --bg: #edf6f0; --bg2: #e3efe7; --line: #dfeae3; --line2: #cbdcd1;
  --gold: #b8860b; --gold-soft: #fbf3dc;
  --shadow: 0 1px 1px rgba(16, 40, 28, .03), 0 6px 20px rgba(16, 40, 28, .06);
  --shadow-lg: 0 16px 48px rgba(16, 40, 28, .16);
  --radius: 18px; --radius-sm: 12px;
}
:root[data-theme="dark"] {
  --bg: #0b1210; --bg2: #0f1815; --card: #121b18; --card2: #17221e; --line: #1f2c27; --line2: #2a3a34;
  --text: #e3ebe7; --muted: #93a39c; --faint: #66766f; --gray-soft: #1a2521;
  --gold: #e2b84f; --gold-soft: #2f2814;
  --shadow: 0 1px 0 rgba(255, 255, 255, .025) inset, 0 6px 20px rgba(0, 0, 0, .25);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0b1210; --bg2: #0f1815; --card: #121b18; --card2: #17221e; --line: #1f2c27; --line2: #2a3a34;
    --text: #e3ebe7; --muted: #93a39c; --faint: #66766f; --gray-soft: #1a2521;
    --gold: #e2b84f; --gold-soft: #2f2814;
    --shadow: 0 1px 0 rgba(255, 255, 255, .025) inset, 0 6px 20px rgba(0, 0, 0, .25);
  }
}
.gold { color: var(--gold); }
.card { border-color: transparent; }
:root[data-theme="dark"] .card { border-color: var(--line); }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .card { border-color: var(--line); } }
.num { font-feature-settings: "tnum" 1, "lnum" 1; }

/* page enter + skeleton */
.view-enter { animation: viewIn .22s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }
.skel { padding-top: 8px; }
.sk { border-radius: var(--radius); background: linear-gradient(90deg, var(--card) 0%, var(--card2) 40%, var(--card) 80%); background-size: 300% 100%; animation: shimmer 1.3s ease-in-out infinite; margin-bottom: 12px; }
.sk-title { height: 30px; width: 45%; border-radius: 10px; margin: 10px 2px 18px; }
.sk-card { height: 150px; } .sk-card.short { height: 90px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* live number flash */
.flash-up { animation: flashUp 1.1s ease; } .flash-down { animation: flashDown 1.1s ease; }
@keyframes flashUp { 0%, 30% { background: color-mix(in srgb, var(--green) 22%, transparent); border-radius: 6px; } }
@keyframes flashDown { 0%, 30% { background: color-mix(in srgb, var(--red) 22%, transparent); border-radius: 6px; } }

/* "new updates" pill + pull to refresh */
.pending-pill { position: fixed; top: calc(64px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 40; border: 0; cursor: pointer;
  background: var(--brand); color: var(--brand-ink); font-weight: 700; padding: 8px 16px; border-radius: 999px; box-shadow: var(--shadow-lg); animation: up .2s ease; }
.ptr { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translate(-50%, -60px); z-index: 45; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; background: var(--card); color: var(--muted); box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .15s; pointer-events: none; font-size: 20px; }
.ptr.on { opacity: 1; } .ptr.ready { color: var(--brand); } .ptr.spin span { display: inline-block; animation: spin .7s linear infinite; }

/* floating glass bottom navigation (phones) */
@media (max-width: 999px) {
  nav.bottom { inset-inline: 10px; bottom: calc(8px + env(safe-area-inset-bottom)); padding: 6px; border-radius: 24px; border: 1px solid color-mix(in srgb, var(--line2) 60%, transparent);
    background: color-mix(in srgb, var(--card) 76%, transparent); box-shadow: 0 10px 30px rgba(10, 30, 20, .14); }
  nav.bottom a { padding: 5px 0 3px; border-radius: 18px; }
  nav.bottom a svg { padding: 4px 16px; }
  nav.bottom a.on svg { background: var(--brand-soft); color: var(--brand); }
  main { padding-bottom: calc(var(--nav-h) + 40px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(var(--nav-h) + 34px + env(safe-area-inset-bottom)); }
}
.btn, .fchip, .seg button, .rc, .icon-btn { -webkit-user-select: none; user-select: none; }

/* filter chips */
.fchips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 0 12px; padding: 2px; }
.fchips::-webkit-scrollbar { display: none; }
.fchip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line2);
  background: var(--card); color: var(--muted); font-weight: 600; font-size: calc(13px * var(--fs, 1)); cursor: pointer; transition: all .15s; }
.fchip.on { background: var(--brand-soft); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.fchip.on.sh { background: var(--green-soft); color: var(--green2); }

/* stars */
.stars { display: inline-flex; align-items: center; gap: 4px; font-size: calc(13px * var(--fs, 1)); letter-spacing: 1px; direction: ltr; white-space: nowrap; }
.stars .on { color: var(--gold); } .stars .off { color: var(--line2); }
.stars small { direction: rtl; letter-spacing: 0; color: var(--muted); font-weight: 600; font-size: calc(11.5px * var(--fs, 1)); }
.stars.s5 .on, .stars.s4 .on { text-shadow: 0 0 10px color-mix(in srgb, var(--gold) 35%, transparent); }

/* recommendation card */
.rc-list { display: grid; gap: 12px; }
@media (min-width: 1000px) { .rc-list { grid-template-columns: 1fr 1fr; } }
.rc { position: relative; background: var(--card); border-radius: var(--radius); padding: 14px 16px 12px; box-shadow: var(--shadow); cursor: pointer; overflow: hidden;
  border: 1px solid transparent; transition: transform .12s ease, box-shadow .15s; }
:root[data-theme="dark"] .rc { border-color: var(--line); }
.rc:active { transform: scale(.99); }
.rc::before, .rc-hero::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px; background: var(--st, var(--faint)); }
.rc-hero { position: relative; overflow: hidden; }
.rc.rs-watch, .rc-hero.rs-watch { --st: var(--amber); } .rc.rs-ready, .rc-hero.rs-ready { --st: var(--brand); }
.rc.rs-active, .rc-hero.rs-active { --st: var(--green); } .rc.rs-target_hit, .rc-hero.rs-target_hit { --st: var(--gold); }
.rc.rs-stopped, .rc-hero.rs-stopped { --st: var(--red); } .rc.rs-tracking_ended, .rc-hero.rs-tracking_ended { --st: var(--orange); }
.rc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.rc-name b { font-size: calc(16.5px * var(--fs, 1)); }
.rc-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.rc-tags.col { flex-direction: column; align-items: flex-end; }
.rc-kind { margin: 2px 0 8px; color: var(--muted); }
.rc-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
.weak { color: var(--orange); font-weight: 600; }
.hscroll { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 10px; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > .rc { flex: none; width: 84%; max-width: 380px; scroll-snap-align: start; }

/* entry vs current price */
.duo { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--card2); }
.duo-sep { width: 1px; align-self: stretch; background: var(--line2); }
.duo-c { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.duo-c .l { font-size: calc(11.5px * var(--fs, 1)); color: var(--muted); font-weight: 600; }
.duo-c .v { font-size: calc(22px * var(--fs, 1)); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; color: var(--text); }
.duo-c .v small { font-size: .6em; color: var(--faint); margin: 0 1px; }
.duo-c .v.up { color: var(--green); } .duo-c .v.down { color: var(--red); }
.duo-c .u { font-size: calc(11px * var(--fs, 1)); color: var(--faint); }
.duo-c .d { font-size: calc(12px * var(--fs, 1)); font-weight: 700; }
.duo.big .duo-c .v { font-size: calc(30px * var(--fs, 1)); }

/* price ruler */
.ruler { direction: ltr; margin: 14px 4px 0; }
.ruler .track { position: relative; height: 8px; border-radius: 4px; background: var(--gray-soft); }
.ruler .z { position: absolute; top: 0; bottom: 0; opacity: .35; }
.ruler .z.risk { background: linear-gradient(90deg, var(--red), color-mix(in srgb, var(--red) 30%, transparent)); border-radius: 4px 0 0 4px; }
.ruler .z.entry { background: var(--blue); opacity: .45; }
.ruler .z.gain { background: linear-gradient(90deg, color-mix(in srgb, var(--green) 30%, transparent), var(--green)); }
.ruler .z.bonus { background: var(--gold); border-radius: 0 4px 4px 0; }
.ruler .fill { position: absolute; top: 2px; bottom: 2px; border-radius: 3px; }
.ruler .fill.up { background: var(--green); } .ruler .fill.down { background: var(--red); }
.ruler .tick { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--card); border-radius: 1px; }
.ruler .mk { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; transform: rotate(45deg); border-radius: 3px; background: var(--text);
  border: 2.5px solid var(--card); box-shadow: 0 2px 8px rgba(0, 0, 0, .25); transition: left .6s ease; z-index: 2; }
.ruler .mk.up { background: var(--green); } .ruler .mk.down { background: var(--red); } .ruler .mk.gold { background: var(--gold); } .ruler .mk.mid { background: var(--amber); }
.ruler .labels { position: relative; margin-top: 5px; font-size: calc(11px * var(--fs, 1)); }
.ruler .rl { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: 1.2; white-space: nowrap; color: var(--muted); }
.ruler .rl small { font-size: calc(10px * var(--fs, 1)); color: var(--faint); direction: rtl; }
.ruler .rl.down b { color: var(--red); } .ruler .rl.up b { color: var(--green); } .ruler .rl.gold b { color: var(--gold); }
.ruler-txt { margin-top: 2px; color: var(--muted); }

/* hero card details */
.rc-hero .sym .n { display: flex; align-items: center; gap: 4px; }
.dist { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 8px; }
.dist > div { background: var(--card2); border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; gap: 1px; }
.dist .l { font-size: calc(11.5px * var(--fs, 1)); color: var(--muted); }
.dist .v { font-weight: 700; font-size: calc(15px * var(--fs, 1)); }
.dist small { font-size: calc(11px * var(--fs, 1)); }
.qty { display: flex; gap: 4px; margin-top: 4px; }
.qty button { border: 1px solid var(--line2); background: var(--card); border-radius: 8px; font-size: calc(11px * var(--fs, 1)); padding: 1px 6px; cursor: pointer; color: var(--muted); }
.qty button.on { background: var(--brand-soft); color: var(--brand); border-color: transparent; font-weight: 700; }
.hist { background: color-mix(in srgb, var(--blue-soft) 70%, transparent); border-radius: 12px; padding: 8px 12px; margin-bottom: 8px; }
.layers, .risks { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.layers li { display: flex; gap: 8px; align-items: flex-start; font-size: calc(13.5px * var(--fs, 1)); }
.layers .ic2 { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.layers li.ok .ic2 { background: var(--green-soft); color: var(--green); }
.layers li.no { color: var(--muted); } .layers li.no .ic2 { background: var(--gray-soft); color: var(--faint); }
.risks li { position: relative; padding-inline-start: 18px; font-size: calc(13.5px * var(--fs, 1)); }
.risks li::before { content: ""; position: absolute; inset-inline-start: 2px; top: .6em; width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }
.levels { display: grid; gap: 6px; }
.lvl { display: inline-flex; gap: 2px; align-items: baseline; background: var(--card2); border-radius: 8px; padding: 1px 8px; margin: 2px 3px; }

/* market pulse */
.pulse { position: relative; border-radius: 22px; padding: 16px 18px 12px; margin-bottom: 6px; color: var(--text); box-shadow: var(--shadow);
  background: linear-gradient(150deg, color-mix(in srgb, var(--rg, var(--amber)) 16%, var(--card)) 0%, var(--card) 70%); border: 1px solid color-mix(in srgb, var(--rg, var(--amber)) 22%, transparent); }
.pulse.rg-up { --rg: var(--green); } .pulse.rg-down { --rg: var(--red); } .pulse.rg-neutral { --rg: var(--amber); }
.pulse-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pulse-l { color: var(--muted); font-weight: 600; }
.pulse-st { font-size: calc(19px * var(--fs, 1)); } .pulse-st b { color: var(--rg); }
.spark { width: 120px; height: 34px; flex: none; }
.pulse-g { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0 8px; }
.pulse-g > div { display: flex; flex-direction: column; gap: 1px; }
.pulse-g .l { font-size: calc(11px * var(--fs, 1)); color: var(--muted); }
.pulse-g .v { font-weight: 800; font-size: calc(15px * var(--fs, 1)); }
.pulse-f { margin-bottom: 4px; }
@media (max-width: 420px) { .pulse-g { grid-template-columns: 1fr 1fr; } }

/* insights bars */
.ins { margin-top: 10px; } .ins-r { display: grid; grid-template-columns: minmax(80px, 1.2fr) 2fr auto auto; gap: 8px; align-items: center; padding: 4px 0; font-size: calc(13px * var(--fs, 1)); }
.ins .bar { height: 8px; border-radius: 4px; background: var(--gray-soft); overflow: hidden; direction: ltr; }
.ins .bar i { display: block; height: 100%; border-radius: 4px; } .ins .bar i.up { background: var(--green); } .ins .bar i.down { background: var(--red); }

/* small interaction feedback */
.list-item, .stat-tile, .tile { transition: transform .12s ease, background .12s; }
.list-item[data-go]:active, .tile:active { transform: scale(.99); }
[dir="ltr"] .rc-tags { justify-content: flex-start; }
.se-t td:first-child { min-width: 150px; }
.home-actions { margin: 4px 0 12px; } .btn.busy { opacity: .75; }
.nowrap, .stat .v.num { white-space: nowrap; }

/* P/L line inside the entry/current box */
.duo-pl { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 10px;
  border-top: 1px dashed var(--line2); padding-top: 8px; margin-top: 2px; font-size: calc(12.5px * var(--fs, 1)); }
.duo-pl .l { font-weight: 700; } .duo-pl.up .l, .duo-pl.up b { color: var(--green); } .duo-pl.down .l, .duo-pl.down b { color: var(--red); }
.duo-pl b { font-size: calc(14px * var(--fs, 1)); }

/* accumulation / distribution */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fl-tiles { margin: 12px 0; } .fl-t { cursor: pointer; text-align: center; border: 2px solid transparent !important; }
.fl-t .big { font-size: calc(26px * var(--fs, 1)); font-weight: 800; }
.fl-ta .bold, .fl-ta .big { color: var(--green); } .fl-td .bold, .fl-td .big { color: var(--red); } .fl-tn .bold { color: var(--muted); }
.fl-t.on.fl-ta { border-color: var(--green) !important; } .fl-t.on.fl-td { border-color: var(--red) !important; } .fl-t.on.fl-tn { border-color: var(--line2) !important; }
.fl-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; cursor: pointer; }
.fl-main { min-width: 0; } .fl-why { color: var(--muted); margin-top: 2px; }
.fl-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.fl-badge { display: inline-flex; gap: 4px; align-items: baseline; padding: 3px 12px; border-radius: 999px; font-weight: 800; font-size: calc(13px * var(--fs, 1)); white-space: nowrap; }
.fl-badge small { font-weight: 600; font-size: .8em; opacity: .85; }
.fl-acc { background: var(--green-soft); color: var(--green2); } .fl-dist { background: var(--red-soft); color: var(--red); }
.fl-norm { background: var(--gray-soft); color: var(--muted); } .fl-none { background: transparent; color: var(--faint); border: 1px dashed var(--line2); }
.fl-meter { position: relative; display: block; width: 74px; height: 6px; border-radius: 3px; background: var(--gray-soft); direction: ltr; }
.fl-meter i { position: absolute; top: 0; bottom: 0; border-radius: 3px; } .fl-meter i.up { background: var(--green); } .fl-meter i.down { background: var(--red); }
.fl-meter b { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--faint); }
.fl-wins { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.fl-wins > div { background: var(--card2); border-radius: 12px; padding: 8px; text-align: center; display: flex; flex-direction: column; gap: 2px; border: 1.5px solid transparent; }
.fl-wins > div.on { border-color: var(--brand); }
.fl-vote { display: grid; grid-template-columns: 1fr auto 48px; gap: 10px; align-items: center; padding: 5px 0; font-size: calc(13px * var(--fs, 1)); }
.fl-vote .fl-meter { width: 110px; }
.fl-chart { width: 100%; height: 190px; display: block; }
.fl-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 6px 0 4px; color: var(--muted); }
.fl-legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-inline-end: 4px; vertical-align: middle; }
@media (max-width: 999px) { nav.bottom a span { font-size: calc(10px * var(--fs, 1)); } nav.bottom a svg { padding: 4px 10px; } }
.duo-pl b.num { direction: ltr; unicode-bidi: isolate; }
.fl-home .grid3 { gap: 8px; }
.fh-c { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 12px; background: var(--card2); cursor: pointer; }
.fh-c .num { font-size: calc(22px * var(--fs, 1)); font-weight: 800; } .fh-c small { font-weight: 700; }
.fh-c.fl-ta .num, .fh-c.fl-ta small { color: var(--green); } .fh-c.fl-td .num, .fh-c.fl-td small { color: var(--red); } .fh-c.fl-tn small { color: var(--muted); }
.fh-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.fh-i { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 5px 0; font-size: calc(13px * var(--fs, 1)); cursor: pointer; border-bottom: 1px solid var(--line); }
.fh-i span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.fh-i .fl-meter { width: 46px; flex: none; }
.fl-wins.four { grid-template-columns: repeat(4, 1fr); margin-top: 0; } .fl-wins.four > div { cursor: pointer; padding: 6px 4px; }
.fh-lists { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.fl-wins.four b { font-size: calc(13px * var(--fs, 1)); white-space: nowrap; }
.fl-home { margin-bottom: 14px; } .grid4 { margin: 12px 0; } .fl-home + .banner { margin-top: 0; }

/* last price tag next to stock names */
.px-tag { display: inline-flex; align-items: baseline; gap: 4px; padding: 1px 8px; border-radius: 8px; background: var(--card2); border: 1px solid var(--line);
  font-size: calc(12.5px * var(--fs, 1)); font-weight: 700; color: var(--text); vertical-align: middle; white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
.px-tag small { font-size: .85em; font-weight: 700; color: var(--muted); }
.px-tag.up small { color: var(--green); } .px-tag.down small { color: var(--red); }
.px-tag.compact { padding: 0 6px; font-size: calc(11.5px * var(--fs, 1)); margin-top: 2px; }
td .px-tag.compact { display: flex; width: max-content; }
.fh-i .px-tag { flex: none; }
/* aligned columns in the home accumulation box: name | price | meter */
.fh-i { display: grid; grid-template-columns: minmax(0, 1fr) 68px 50px; gap: 8px; align-items: center; }
.fh-i .px-tag { justify-self: start; justify-content: center; min-width: 54px; }
.fh-i .fl-meter { justify-self: end; width: 50px; }
@media (max-width: 600px) { .fh-lists { grid-template-columns: minmax(0, 1fr); gap: 14px; } }
.diag summary { cursor: pointer; } .dg-r { padding: 4px 0; border-bottom: 1px solid var(--line); } .dg-sep { height: 8px; } .diag .banner { margin: 8px 0; }

/* marks: earnings this year vs last, thin liquidity */
.mks { display: inline-flex; gap: 4px; flex-wrap: wrap; vertical-align: middle; margin-inline-start: 6px; }
.rec-head .mks, .rc-hero .mks { margin: 4px 0 0; display: flex; }
.mk { display: inline-flex; align-items: center; gap: 2px; padding: 0 7px; border-radius: 999px; font-size: calc(10.5px * var(--fs, 1)); font-weight: 700;
  line-height: 1.7; white-space: nowrap; cursor: pointer; border: 1px solid transparent; }
.mk-up { background: var(--green-soft); color: var(--green2); }
.mk-down { background: var(--amber-soft, #fdf3dc); color: #a16207; }
.mk-turnp { background: var(--blue-soft); color: var(--blue); }
.mk-turnl { background: color-mix(in srgb, var(--orange) 16%, transparent); color: var(--orange); }
.mk-loss { background: var(--red-soft); color: var(--red); }
.mk-thin { background: var(--gray-soft); color: var(--muted); border-color: var(--line2); }
:root[data-theme="dark"] .mk-down { background: #2f2814; color: #e2b84f; }
.act-logo { position: relative; } .act-dot { position: absolute; bottom: -2px; inset-inline-end: -2px; width: 12px; height: 12px; border-radius: 50%; background: var(--green); border: 2px solid var(--card); } .chev { color: var(--faint); font-size: 20px; }
