/* Aurum Live v2 — trading-terminal layout.
   Desktop/tablet: icon rail + top bar + page. Phone: top bar + page + bottom tab bar.
   Market page always fits the screen; Analysis and Settings scroll inside the page. */
:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel-2: #f0f2f5;
  --panel-3: #e7eaee;
  --line: #e2e5ea;
  --text: #12151a;
  --muted: #5d6570;
  --dim: #6f7782;
  --gold: #a87412;
  --gold-soft: rgba(168, 116, 18, .12);
  --silver: #5f6d7e;
  --silver-soft: rgba(95, 109, 126, .13);
  --up: #079a5c;
  --up-soft: rgba(7, 154, 92, .11);
  --down: #d5303c;
  --down-soft: rgba(213, 48, 60, .1);
  --warn: #c2740c;
  --warn-soft: rgba(194, 116, 12, .12);
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --on-accent: #ffffff;
  --accent: var(--gold);
  --accent-soft: var(--gold-soft);

  --f-ui: "IBM Plex Sans", "Vazirmatn", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-num: "IBM Plex Mono", "Vazirmatn", ui-monospace, "SF Mono", Menlo, monospace;
  --f-fa: "Vazirmatn", "IBM Plex Sans", Tahoma, sans-serif;

  --r: 12px;
  --r-sm: 8px;
  --gap: 10px;
  --rail: 76px;
  --top: 56px;
  --tab: 60px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b0d10;
  --panel: #13161b;
  --panel-2: #1a1e24;
  --panel-3: #232830;
  --line: #242930;
  --text: #e9ebee;
  --muted: #8d949e;
  --dim: #808893;
  --gold: #e6b75b;
  --gold-soft: rgba(230, 183, 91, .13);
  --silver: #b8c4d2;
  --silver-soft: rgba(184, 196, 210, .12);
  --up: #19c37d;
  --up-soft: rgba(25, 195, 125, .12);
  --down: #f0444f;
  --down-soft: rgba(240, 68, 79, .12);
  --warn: #f2a33a;
  --warn-soft: rgba(242, 163, 58, .12);
  --shadow: none;
  --on-accent: #17120a;
  color-scheme: dark;
}
:root[data-metal="xag"] { --accent: var(--silver); --accent-soft: var(--silver-soft); }
:root[lang="fa"] { --f-ui: "Vazirmatn", "IBM Plex Sans", Tahoma, sans-serif; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
  font: 500 14px/1.45 var(--f-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-family: var(--f-num); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.up { color: var(--up) !important; }
.down { color: var(--down) !important; }

/* ---------- Shell ---------- */
.shell {
  position: fixed; inset: 0;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  padding-top: env(safe-area-inset-top, 0px);
  transition: filter .35s ease;
}
body.locked .shell, body.picking .shell { filter: blur(16px) saturate(.6); pointer-events: none; }
.main { display: grid; grid-template-rows: var(--top) minmax(0, 1fr); min-width: 0; min-height: 0; }

/* Rail (desktop + tablet) */
.rail {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 8px calc(env(safe-area-inset-bottom, 0px) + 12px);
  background: var(--panel);
  border-inline-end: 1px solid var(--line);
}
.logo { width: 36px; height: 36px; display: grid; place-items: center; margin-bottom: 14px; border-radius: 10px; background: var(--accent-soft); }
.logo svg { width: 24px; height: 16px; }
.nav-btn {
  width: 60px; padding: 9px 0 7px;
  display: grid; justify-items: center; gap: 4px;
  border: 0; border-radius: 10px; background: transparent;
  color: var(--muted); font-size: 10.5px; font-weight: 600;
}
.nav-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-btn:hover { background: var(--panel-2); color: var(--text); }
.nav-btn[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.rail .spacer { flex: 1; }
.rail .foot { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 10px; color: var(--dim); opacity: .7; letter-spacing: .04em; white-space: nowrap; }
:root[dir="rtl"] .rail .foot { transform: none; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  min-width: 0;
}
.brand-m { display: none; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.brand-m svg { width: 22px; height: 14px; }
.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line);
}
.seg button {
  padding: 6px 12px; border: 0; border-radius: 7px; background: transparent;
  color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
:root[data-theme="dark"] .seg button[aria-pressed="true"] { background: var(--panel-3); }
.seg .dotm { width: 8px; height: 8px; border-radius: 50%; }
.dotm.g { background: var(--gold); } .dotm.s { background: var(--silver); }
.tickers { display: flex; gap: 18px; margin-inline-start: 8px; min-width: 0; overflow: hidden; }
.tk { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; font-size: 12.5px; }
.tk b { font-weight: 600; color: var(--muted); }
.tk .num { font-size: 13px; }
.top-sp { flex: 1; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 99px;
  background: var(--panel-2); border: 1px solid var(--line);
  font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap;
}
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); flex: none; }
.pill.live { color: var(--up); } .pill.live i { background: var(--up); animation: beat 1.6s ease-out infinite; }
.pill.closed { color: var(--warn); } .pill.closed i { background: var(--warn); }
.pill.err { color: var(--down); } .pill.err i { background: var(--down); }
@keyframes beat { 0% { box-shadow: 0 0 0 0 var(--up-soft); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
.icon-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 10px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  font: 500 12.5px var(--f-num);
}
.icon-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.low { color: var(--warn); border-color: var(--warn-soft); }

/* Session timer line */
.timer { position: fixed; top: env(safe-area-inset-top, 0px); inset-inline: 0; height: 3px; z-index: 6; background: var(--accent-soft); }
.timer i { display: block; height: 100%; width: 100%; transform-origin: left center; background: var(--accent); transition: transform 1s linear; }
:root[dir="rtl"] .timer i { transform-origin: right center; }
.timer.low i { background: var(--warn); }

/* Pages */
.pages { position: relative; min-height: 0; }
.page { position: absolute; inset: 0; }
.page.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 18px 18px 28px; }
.page-foot { text-align: center; font-size: 11px; color: var(--dim); opacity: .75; padding: 18px 0 4px; letter-spacing: .02em; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 0; }
.card-t { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
:root[lang="fa"] .card-t { letter-spacing: 0; text-transform: none; font-size: 13px; }
.card-b { padding: 12px 14px 14px; }

/* ---------- Market page ---------- */
.market {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: var(--gap);
  padding: var(--gap);
}
.m-col { display: flex; flex-direction: column; gap: var(--gap); min-height: 0; min-width: 0; }
.hero { padding: 14px 16px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 22px; }
.hero-l { display: grid; gap: 2px; }
.hero-label { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: .04em; }
.hero-label span { color: var(--dim); font-weight: 500; letter-spacing: 0; }
.hero-row { display: flex; align-items: center; gap: 12px; }
.hero-price { font: 600 clamp(32px, 4.2vw, 44px)/1.05 var(--f-num); letter-spacing: -.02em; font-variant-numeric: tabular-nums; direction: ltr; transition: color .6s ease; }
.hero-price .dec { font-size: .58em; color: var(--muted); }
.hero-price.flash-up { color: var(--up); transition: none; }
.hero-price.flash-down { color: var(--down); transition: none; }
.chg { font: 600 13px var(--f-num); padding: 5px 9px; border-radius: 8px; background: var(--panel-2); color: var(--muted); white-space: nowrap; direction: ltr; }
.chg.up { background: var(--up-soft); } .chg.down { background: var(--down-soft); }
.quote-line { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--dim); padding-bottom: 4px; }
.quote-line > span { display: inline-flex; gap: 4px; align-items: baseline; }
.quote-line b { font: 500 12.5px var(--f-num); color: var(--muted); margin-inline-start: 4px; direction: ltr; unicode-bidi: isolate; }
.quote-line .tick { font-family: var(--f-num); }

.chart-card { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.chart-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px 6px; border-bottom: 1px solid var(--line); }
.tfs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; direction: ltr; }
.tfs::-webkit-scrollbar { display: none; }
.tfs button { padding: 5px 9px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: 600 12px var(--f-num); white-space: nowrap; }
.tfs button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.legend { display: flex; gap: 10px; font-size: 11px; color: var(--dim); white-space: nowrap; }
.legend i { display: inline-block; width: 10px; height: 2px; border-radius: 2px; vertical-align: middle; margin-inline-end: 4px; }
#chart { flex: 1 1 auto; min-height: 0; position: relative; }
.chart-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); font-size: 12.5px; pointer-events: none; }

.board { padding: 4px 14px 10px; }
.board table { width: 100%; border-collapse: collapse; }
.board th { padding: 9px 0 7px; text-align: end; font-size: 11px; font-weight: 700; color: var(--accent); border-bottom: 1px solid var(--line); }
.board th small { display: block; font: 500 10px var(--f-num); color: var(--dim); }
.board th:first-child { text-align: start; }
.board td { padding: 8px 0; border-bottom: 1px solid var(--line); text-align: end; white-space: nowrap; }
.board tr:last-child td { border-bottom: 0; }
.board td:first-child { text-align: start; }
.cur { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.sym { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font: 600 11px var(--f-num); }
.val { font: 500 14.5px var(--f-num); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; transition: color .6s ease; }
.val.flash-up { color: var(--up); transition: none; } .val.flash-down { color: var(--down); transition: none; }
.val small { display: block; font: 500 10px var(--f-ui); color: var(--dim); margin-top: 1px; }
.board-mini, .sheet-head, .sheet-back { display: none; }
.board-foot { padding-top: 8px; border-top: 1px dashed var(--line); font: 500 10.5px var(--f-ui); color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.desk { flex: none; overflow: hidden; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.tabs button { position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 4px 10px; border: 0; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.tabs button[aria-selected="true"] { color: var(--text); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; inset-inline: 24%; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.count { font: 600 10px var(--f-num); padding: 1px 6px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.panel { padding: 12px; height: 136px; display: flex; flex-direction: column; gap: 10px; }
.sig { display: flex; align-items: center; gap: 12px; min-height: 42px; }
.sig-dir { flex: none; min-width: 88px; padding: 9px 10px; border-radius: 10px; text-align: center; font-weight: 700; font-size: 17px; letter-spacing: .04em; background: var(--panel-2); color: var(--muted); }
:root[lang="fa"] .sig-dir { letter-spacing: 0; }
.sig-dir[data-dir="BUY"] { background: var(--up); color: #fff; }
.sig-dir[data-dir="SELL"] { background: var(--down); color: #fff; }
.sig-dir[data-dir="WAIT"] { background: var(--accent-soft); color: var(--accent); }
.sig-dir[data-dir="CLOSED"] { background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.sig-dir.pop { animation: pop .5s ease; }
@keyframes pop { 30% { transform: scale(1.07); } }
.sig-side { flex: 1; min-width: 0; display: grid; gap: 6px; }
.meter { height: 5px; border-radius: 9px; background: var(--panel-3); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: 9px; background: var(--accent); transition: width .6s ease; }
.sig-note { font-size: 12px; color: var(--muted); line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sig-time { font-size: 11px; color: var(--dim); }
.levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.levels div { padding: 6px 8px; border-radius: 8px; background: var(--panel-2); min-width: 0; }
.levels span { display: block; font-size: 10.5px; font-weight: 600; color: var(--dim); white-space: nowrap; }
.levels b { display: block; font: 500 12.5px var(--f-num); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; text-align: start; }
:root[dir="rtl"] .levels b { text-align: end; }
.levels b.up { color: var(--up); } .levels b.dn { color: var(--down); }
.alert-form { display: flex; gap: 8px; }
.alert-form input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); font: 500 14px var(--f-num); direction: ltr; }
.alert-form input::placeholder { font: 500 12.5px var(--f-ui); color: var(--dim); }
:root[dir="rtl"] .alert-form input::placeholder { direction: rtl; }
.btn { padding: 0 16px; min-height: 40px; border: 0; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 13px; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.alert-list { display: flex; flex-wrap: wrap; gap: 6px; overflow: hidden; max-height: 60px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); font: 500 12.5px var(--f-num); direction: ltr; }
.chip .arr { color: var(--accent); font-size: 10px; }
.chip button { border: 0; background: transparent; color: var(--dim); width: 20px; height: 20px; border-radius: 50%; padding: 0; font-size: 14px; line-height: 1; }
.hint { font-size: 11.5px; color: var(--dim); }
.glance { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.glance .card-b { display: grid; gap: 8px; align-content: start; }
.gl-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); }
.gl-row b { display: block; font-size: 13px; }
.gl-row small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; direction: inherit; }
.gl-v { flex: none; padding: 6px 12px; border-radius: 8px; font-weight: 700; font-size: 13px; background: var(--panel-3); color: var(--muted); }
.gl-v.BUY { background: var(--up); color: #fff; } .gl-v.NO_BUY { background: var(--down); color: #fff; }
.gl-v.WAIT, .gl-v.WAIT_PULLBACK { background: var(--warn-soft); color: var(--warn); } .gl-v.CLOSED { background: var(--warn-soft); color: var(--warn); }
.gl-disc { margin-top: auto; padding: 10px 14px 12px; font-size: 11px; color: var(--dim); }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-size: 12px; font-weight: 600; }
.m-foot { text-align: center; font-size: 10.5px; color: var(--dim); opacity: .7; letter-spacing: .02em; padding-top: 2px; }

/* ---------- Analysis page ---------- */
.an-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 14px; }
.an-head h1 { margin: 0; font-size: 22px; font-weight: 700; }
.an-sub { color: var(--muted); font-size: 13px; }
.an-head .top-sp { flex: 1; }
.an-upd { font-size: 12px; color: var(--dim); }
.disc-strip { display: flex; gap: 10px; align-items: center; padding: 10px 14px; margin-bottom: 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 12.5px; font-weight: 600; }
.disc-strip svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.an-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; } .span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; } .span-3 { grid-column: span 3; }

.verdict { padding: 16px; display: grid; gap: 12px; justify-items: center; text-align: center; }
.gauge { width: 100%; max-width: 300px; }
.gauge text { font: 600 10px var(--f-ui); fill: var(--dim); }
.v-word { font-size: 30px; font-weight: 700; line-height: 1.1; }
.v-word.BUY { color: var(--up); } .v-word.NO_BUY { color: var(--down); } .v-word.WAIT, .v-word.WAIT_PULLBACK { color: var(--warn); }
.v-sub { color: var(--muted); font-size: 13.5px; max-width: 34ch; }
.v-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.stat { padding: 9px 8px; border-radius: 10px; background: var(--panel-2); }
.stat span { display: block; font-size: 11px; color: var(--dim); font-weight: 600; }
.stat b { display: block; font: 600 16px var(--f-num); margin-top: 2px; }
.conf-bar { height: 4px; border-radius: 4px; background: var(--panel-3); margin-top: 6px; overflow: hidden; }
.conf-bar i { display: block; height: 100%; background: var(--accent); }

.summary p { margin: 0 0 8px; font-size: 14.5px; line-height: 1.7; }
.flags { display: grid; gap: 6px; margin-top: 10px; }
.flag { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; background: var(--warn-soft); color: var(--text); font-size: 12.5px; }
.flag::before { content: "!"; flex: none; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--warn); color: #fff; font: 700 11px var(--f-num); margin-top: 1px; }

.plan-dir { display: inline-flex; gap: 8px; align-items: center; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px; }
.plan-dir.long { background: var(--up-soft); color: var(--up); } .plan-dir.short { background: var(--down-soft); color: var(--down); }
.plan-cond { font-size: 11.5px; color: var(--warn); font-weight: 600; }
.plan-rows { display: grid; gap: 0; margin-top: 10px; }
.plan-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.plan-row:last-child { border-bottom: 0; }
.plan-row span { color: var(--muted); }
.plan-row b { font: 600 14px var(--f-num); direction: ltr; unicode-bidi: isolate; }
.plan-row small { font: 500 11px var(--f-num); color: var(--dim); margin-inline-start: 6px; }
.plan-note { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.6; }

.tf-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tf-table th { text-align: start; font-size: 11px; color: var(--dim); font-weight: 600; padding: 0 0 6px; }
.tf-table td { padding: 8px 0; border-top: 1px solid var(--line); }
.tf-table td.n { font-family: var(--f-num); direction: ltr; text-align: start; }
:root[dir="rtl"] .tf-table td.n { text-align: end; }
.rate { display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.rate.strong_buy { background: var(--up); color: #fff; } .rate.buy { background: var(--up-soft); color: var(--up); }
.rate.neutral { background: var(--panel-2); color: var(--muted); }
.rate.sell { background: var(--down-soft); color: var(--down); } .rate.strong_sell { background: var(--down); color: #fff; }
.trend-ic { font-size: 13px; }

.ladder { display: grid; gap: 4px; }
.lad { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 7px 10px; border-radius: 8px; font-size: 12.5px; }
.lad.res { background: var(--down-soft); } .lad.sup { background: var(--up-soft); }
.lad.now { background: var(--accent-soft); font-weight: 700; }
.lad b { font: 600 13.5px var(--f-num); direction: ltr; }
.lad small { display: block; font-size: 10.5px; color: var(--dim); font-weight: 500; }
.piv { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; font-size: 11px; color: var(--dim); }
.piv b { font: 500 11.5px var(--f-num); color: var(--muted); }

.reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.rcol h3 { margin: 0 0 8px; font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.rcol h3 i { width: 8px; height: 8px; border-radius: 50%; }
.rcol.bull h3 i { background: var(--up); } .rcol.bear h3 i { background: var(--down); } .rcol.neutral h3 i { background: var(--warn); }
.rcol ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rcol li { position: relative; padding: 7px 10px; border-radius: 8px; background: var(--panel-2); font-size: 12.5px; line-height: 1.5; }
.rcol li .w { display: inline-flex; gap: 2px; margin-inline-start: 6px; vertical-align: middle; }
.rcol li .w i { width: 4px; height: 8px; border-radius: 1px; background: var(--panel-3); }
.rcol.bull li .w i.on { background: var(--up); } .rcol.bear li .w i.on { background: var(--down); } .rcol.neutral li .w i.on { background: var(--warn); }
.rcol.neutral { grid-column: 1 / -1; }
.rcol .none { color: var(--dim); font-size: 12px; background: transparent; padding: 0; }

.ind-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ind-table td { padding: 7px 0; border-top: 1px solid var(--line); }
.ind-table tr:first-child td { border-top: 0; }
.ind-table td.v { font-family: var(--f-num); text-align: end; direction: ltr; padding-inline: 10px; color: var(--muted); }
:root[dir="rtl"] .ind-table td.v { text-align: start; }
.ind-table td.s { text-align: end; width: 1%; }

.ctx { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.ctx div { padding: 10px 12px; border-radius: 10px; background: var(--panel-2); min-width: 0; }
.ctx span { display: block; font-size: 11px; color: var(--dim); font-weight: 600; }
.ctx b { display: block; font-size: 14px; font-weight: 600; margin-top: 3px; }
.ctx small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.disclaimer { padding: 14px 16px; font-size: 13px; line-height: 1.75; color: var(--muted); }
.disclaimer b { color: var(--text); }
.empty { padding: 50px 16px; text-align: center; color: var(--muted); }
.skeleton { color: var(--dim); }

/* ---------- Settings ---------- */
.set-wrap { max-width: 760px; margin: 0 auto; padding: 18px 18px 28px; display: grid; gap: 14px; }
.set-wrap h1 { margin: 0 0 4px; font-size: 22px; }
.group h2 { margin: 0; padding: 12px 16px 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
:root[lang="fa"] .group h2 { letter-spacing: 0; text-transform: none; font-size: 13px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.group h2 + .row { border-top: 0; }
.row-l { min-width: 0; }
.row-l b { display: block; font-size: 14px; font-weight: 600; }
.row-l small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.45; }
.row .seg button { padding: 6px 10px; font-size: 12.5px; }
.switch { position: relative; flex: none; width: 46px; height: 28px; border-radius: 99px; border: 0; background: var(--panel-3); padding: 0; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: inset-inline-start .2s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { inset-inline-start: 21px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.chips button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.row.stack { flex-direction: column; align-items: stretch; }
.set-alerts { display: flex; flex-wrap: wrap; gap: 6px; }
.about { font-size: 12px; color: var(--muted); line-height: 1.6; }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center;
  padding: 20px 16px;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  opacity: 0; visibility: hidden;
  transition: opacity .3s ease, visibility 0s linear .3s;
}
.overlay.show { opacity: 1; visibility: visible; transition: opacity .3s ease; }
.ov-card { width: min(340px, 100%); display: grid; justify-items: center; gap: 10px; text-align: center; }
.ov-logo { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.ov-logo svg { width: 40px; height: 26px; }
.ov-card h1 { margin: 6px 0 0; font-size: 22px; font-weight: 700; }
.ov-card p { margin: 0; color: var(--muted); font-size: 13.5px; }
.ov-foot { font-size: 11px !important; color: var(--dim) !important; opacity: .8; margin-top: 8px !important; }
.lang-btns { display: grid; gap: 10px; width: 100%; margin-top: 10px; }
.lang-btns button { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); font-size: 16px; font-weight: 600; box-shadow: var(--shadow); }
.lang-btns button span:last-child { color: var(--dim); font-size: 12px; font-family: var(--f-num); }
.lang-btns button:hover { border-color: var(--accent); }
.lang-btns .fa { font-family: var(--f-fa); direction: rtl; }
#lockMsg.err { color: var(--down); }
.dots { display: flex; gap: 10px; height: 18px; align-items: center; margin: 6px 0 4px; direction: ltr; }
.dots i { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--accent); }
.dots i.on { background: var(--accent); }
.dots.shake { animation: shake .4s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; margin-top: 6px; direction: ltr; }
.pad button { height: clamp(50px, 8vh, 62px); border-radius: 14px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); font: 500 22px var(--f-num); transition: transform .08s ease; }
.pad button:active { transform: scale(.95); }
.pad .soft { background: transparent; border-color: transparent; box-shadow: none; }
.pad .soft svg { width: 26px; height: 26px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.pad .go { font: 700 14px var(--f-ui); background: var(--accent); color: var(--on-accent); border: 0; }
.pad .go:disabled { opacity: .5; }

.toast {
  position: fixed; z-index: 30;
  left: 50%; top: calc(env(safe-area-inset-top, 0px) + 14px);
  transform: translateX(-50%);
  width: min(440px, calc(100% - 28px));
  padding: 12px 14px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--accent);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
  font-weight: 600; font-size: 13.5px;
  animation: drop .35s ease;
}
@keyframes drop { from { transform: translate(-50%, -20px); opacity: 0; } }

.tabbar { display: none; }

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  .market { grid-template-columns: minmax(0, 1fr) 320px; }
  .tickers { display: none; }
  .levels b { font-size: 11.5px; }
  .levels div { padding: 6px 6px; }
  .an-grid .span-5, .an-grid .span-7 { grid-column: span 6; }
  .an-grid .span-3, .an-grid .span-4 { grid-column: span 6; }
  .an-grid .span-8 { grid-column: span 12; }
  .ctx { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Phone ---------- */
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) calc(var(--tab) + env(safe-area-inset-bottom, 0px)); }
  .rail { display: none; }
  :root { --top: 52px; --gap: 8px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .brand-m { display: none; }
  .topbar .seg button { padding: 6px 10px; }
  #themeBtn { display: none; }
  .tabbar {
    display: grid; grid-template-columns: repeat(3, 1fr);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--panel); border-top: 1px solid var(--line);
  }
  .tabbar .nav-btn { width: auto; border-radius: 0; font-size: 11px; }
  .tabbar .nav-btn[aria-current="page"] { background: transparent; }
  .market { display: flex; flex-direction: column; padding: 8px 10px; gap: 8px; }
  .m-col { display: contents; }
  .hero { order: 1; padding: 0 4px; border: 0; background: transparent; box-shadow: none; gap: 2px 10px; }
  .hero-price { font-size: clamp(30px, 10vw, 40px); }
  .quote-line { width: 100%; gap: 2px 12px; font-size: 11px; padding-bottom: 0; }
  /* Compact price strip; the full table opens as a bottom sheet */
  .board-mini {
    order: 2; display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)) auto; align-items: center; gap: 6px;
    padding: 9px 10px; text-align: start; border: 1px solid var(--line); cursor: pointer;
  }
  .board-mini:active { transform: scale(.99); }
  .bm-cell { display: grid; gap: 1px; min-width: 0; padding-inline-end: 6px; border-inline-end: 1px solid var(--line); }
  .bm-cell:nth-last-child(2) { border-inline-end: 0; }
  .bm-cell small { display: flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 600; color: var(--muted); }
  .bm-sym { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); font: 600 9.5px var(--f-num); }
  .bm-cell b { font: 600 14px var(--f-num); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .6s ease; }
  .bm-cell b.flash-up { color: var(--up); transition: none; } .bm-cell b.flash-down { color: var(--down); transition: none; }
  :root[dir="rtl"] .bm-cell b { text-align: right; }
  .bm-cell em { font: 500 10.5px var(--f-ui); font-style: normal; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bm-more { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--panel-2); }
  .bm-more svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
  .sheet-back { position: fixed; inset: 0; z-index: 15; background: rgba(0, 0, 0, .45); }
  body.sheet-open .sheet-back { display: block; }
  .board {
    display: none; position: fixed; z-index: 16; inset-inline: 0; bottom: 0;
    max-height: 88%; overflow-y: auto;
    padding: 0 18px calc(env(safe-area-inset-bottom, 0px) + 20px);
    border-radius: 20px 20px 0 0; border-bottom: 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, .35);
    animation: sheetUp .28s ease;
  }
  body.sheet-open .board { display: block; }
  @keyframes sheetUp { from { transform: translateY(40%); opacity: 0; } }
  .sheet-head { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 10px 0 8px; position: relative; }
  .grab { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 40px; height: 4px; border-radius: 4px; background: var(--panel-3); }
  .sheet-head h2 { margin: 12px 0 0; font-size: 16px; font-weight: 700; }
  .sheet-x { margin-top: 12px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--panel-2); color: var(--muted); font-size: 22px; line-height: 1; }
  .board th { padding: 12px 0 10px; font-size: 13px; }
  .board th small { font-size: 11px; }
  .board td { padding: 14px 0; }
  .board .cur { font-size: 14.5px; }
  .board .sym { width: 28px; height: 28px; font-size: 13px; border-radius: 8px; }
  .board .val { font-size: 17px; }
  .board .val small { font-size: 11.5px; margin-top: 3px; }
  .board-foot { white-space: normal; font-size: 12px; line-height: 1.6; padding-top: 12px; }
  .val { font-size: 13.5px; }
  .chart-card { order: 3; min-height: 120px; }
  .desk { order: 4; }
  .glance { display: none; }
  .panel { height: 124px; padding: 10px; gap: 8px; }
  .wrap, .set-wrap { padding: 14px 12px 24px; }
  .an-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .an-grid > * { grid-column: auto !important; }
  .ord-1 { order: 1; } .ord-2 { order: 2; } .ord-3 { order: 3; } .ord-4 { order: 4; } .ord-5 { order: 5; } .ord-6 { order: 6; } .ord-7 { order: 7; } .ord-8 { order: 8; } .ord-9 { order: 9; } .ord-10 { order: 10; } .ord-11 { order: 11; }
  .reasons { grid-template-columns: 1fr; }
  .ctx { grid-template-columns: 1fr 1fr; }
  .an-head h1 { font-size: 19px; }
  .row { padding: 12px 14px; }
}
@media (max-width: 760px) and (max-height: 700px) {
  .quote-line { display: none; }
  .hero-price { font-size: 30px; }
  .chart-card { min-height: 90px; }
  .chart-top { padding: 5px 8px 4px; }
  .legend { display: none; }
  .board-mini { padding: 7px 10px; }
  .panel { height: 112px; padding: 8px 10px; }
  .tabs button { padding: 8px 4px 7px; }
  .sig-dir { font-size: 15px; min-width: 76px; padding: 8px; }
}
@media (max-width: 360px) {
  .val { font-size: 12.5px; }
  .levels b { font-size: 11.5px; }
  .topbar .seg button { padding: 6px 8px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =====================================================================
   v3 additions: markets picker, MT5 page, lessons, assistant, logo
   ===================================================================== */
::selection { background: var(--accent-soft); color: var(--text); }
* { scrollbar-width: thin; scrollbar-color: var(--panel-3) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 8px; }
input, select, textarea { caret-color: var(--accent); }
:root { --sym-xau: var(--gold); --sym-xag: var(--silver); --sym-fx: #4f8cff; --sym-oil: #b7793f; }
:root[data-kind="fx"] { --accent: #4f8cff; --accent-soft: rgba(79, 140, 255, .13); }
:root[data-kind="oil"] { --accent: #c4864a; --accent-soft: rgba(196, 134, 74, .14); }
:root[data-theme="light"][data-kind="fx"] { --accent: #2563d9; --accent-soft: rgba(37, 99, 217, .1); }
:root[data-theme="light"][data-kind="oil"] { --accent: #9a5f22; --accent-soft: rgba(154, 95, 34, .11); }

/* Animated logo: a light sweep over the ingot and three bars that rise in turn */
.logo-anim { width: 100%; height: 100%; overflow: visible; }
.logo .logo-anim { width: 26px; height: 17px; }
.ov-logo .logo-anim { width: 42px; height: 27px; }
.la-bar { fill: rgba(80, 52, 10, .38); transform-box: fill-box; transform-origin: bottom; animation: laBar 3.6s cubic-bezier(.16, 1, .3, 1) infinite; }
.la-bar.b2 { animation-delay: .25s; } .la-bar.b3 { animation-delay: .5s; }
@keyframes laBar { 0%, 100% { transform: scaleY(.35); } 30%, 70% { transform: scaleY(1); } }
.la-shine { animation: laShine 4.8s cubic-bezier(.4, 0, .2, 1) infinite; }
@keyframes laShine { 0%, 55% { transform: translateX(0) skewX(-20deg); } 85%, 100% { transform: translateX(110px) skewX(-20deg); } }

/* Symbol button + dots */
.sym-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-weight: 600; font-size: 14px; min-width: 0; }
.sym-btn:hover { border-color: var(--accent); }
.sym-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
.sym-code { font-size: 11.5px; color: var(--dim); }
.sym-btn .chev { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; transition: transform .2s; }
.sym-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.sym-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--sym-fx); }
.sym-dot[data-kind="xau"] { background: var(--sym-xau); } .sym-dot[data-kind="xag"] { background: var(--sym-xag); }
.sym-dot[data-kind="brent"], .sym-dot[data-kind="wti"] { background: var(--sym-oil); }
.ask-top { display: none !important; }
.tk { border: 0; background: none; padding: 4px 6px; border-radius: 8px; cursor: pointer; color: inherit; }
.tk:hover { background: var(--panel-2); }

/* Picker: popover on desktop, bottom sheet on phones */
.picker-back { position: fixed; inset: 0; z-index: 17; }
.picker { position: fixed; z-index: 18; top: calc(env(safe-area-inset-top, 0px) + var(--top) - 4px); inset-inline-start: calc(var(--rail) + 12px);
  width: 360px; max-height: min(560px, 80vh); overflow-y: auto; padding: 6px 8px 10px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(0, 0, 0, .35); animation: pop2 .18s cubic-bezier(.16, 1, .3, 1); }
@keyframes pop2 { from { opacity: 0; transform: translateY(-6px); } }
.picker-head { display: none; }
.pk-group h3 { margin: 10px 8px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
:root[lang="fa"] .pk-group h3 { letter-spacing: 0; text-transform: none; font-size: 12px; }
.pk-row { width: 100%; display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 10px; background: transparent; text-align: start; color: inherit; }
.pk-row:hover, .pk-row:focus-visible { background: var(--panel-2); }
.pk-row[aria-current="true"] { background: var(--accent-soft); }
.pk-name b { display: block; font-size: 14px; font-weight: 600; }
.pk-name small { font-size: 11px; color: var(--dim); }
.pk-px { font-size: 14px; font-weight: 500; }
.pk-ch { font-size: 12px; min-width: 58px; text-align: end; color: var(--muted); }

/* Quote board for forex / oil */
.qtable { width: 100%; border-collapse: collapse; display: none; }
.qtable td { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.qtable td.val { text-align: end; color: var(--text); font-size: 14.5px; }
.qtable tr:last-child td { border-bottom: 0; }
:root:not([data-kind="metal"]) .board > table:not(.qtable) { display: none; }
:root:not([data-kind="metal"]) .qtable { display: table; }
:root:not([data-kind="metal"]) .bm-cell[data-cur] { display: none; }
:root[data-kind="metal"] .bm-q { display: none; }
:root:not([data-kind="metal"]) .board-mini { --cols: 3 !important; }
.chip .arr svg { width: 9px; height: 9px; fill: var(--accent); display: block; }
.chip button svg, .sheet-x svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.sheet-x { display: grid; place-items: center; }
.trend-ic { width: 10px; height: 10px; fill: currentColor; vertical-align: -1px; }

/* Page heads */
.pg-head { margin-bottom: 16px; max-width: 70ch; }
.pg-head h1 { margin: 0 0 6px; font-size: 24px; font-weight: 700; text-wrap: balance; }
.lede { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.65; }

/* Analysis: scenarios, history, plan button */
.scen { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sc { padding: 12px; border-radius: 10px; background: var(--panel-2); display: grid; gap: 8px; align-content: start; }
.sc-top { display: flex; justify-content: space-between; align-items: baseline; }
.sc-top b { font-size: 14px; } .sc-top span { font-size: 18px; font-weight: 600; }
.sc-bar { height: 5px; border-radius: 5px; background: var(--panel-3); overflow: hidden; }
.sc-bar i { display: block; height: 100%; border-radius: 5px; }
.sc.bull .sc-bar i { background: var(--up); } .sc.bear .sc-bar i { background: var(--down); } .sc.range .sc-bar i { background: var(--warn); }
.sc.bull .sc-top span { color: var(--up); } .sc.bear .sc-top span { color: var(--down); } .sc.range .sc-top span { color: var(--warn); }
.sc p { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.bt-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bt-verdict { margin: 12px 0 6px; font-size: 13px; font-weight: 600; }
.bt-verdict.good { color: var(--up); } .bt-verdict.bad { color: var(--down); }
.plan-calc { margin-top: 12px; width: 100%; }

/* MT5 page */
.mt5-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.mt5-grid .how { grid-column: 2; }
.mt5-grid .calc { grid-row: span 2; }
.f-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.f { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); min-width: 0; }
.f input, .f select, .sel select { width: 100%; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: 500 14.5px var(--f-num); }
.f select, .sel select { font-family: var(--f-ui); font-size: 13.5px; }
.f input:focus, .f select:focus, .sel select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.f input { direction: ltr; }
.f-wide { grid-column: 1 / -1; }
.risk-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.risk-row .chips { flex-wrap: nowrap; }
.risk-row input { width: 76px; flex: none; }
.lc-out { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.lc-main { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lc-main div { padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); }
.lc-main div:last-child { background: var(--panel-2); }
.lc-main span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.lc-main b { display: block; font-size: 30px; font-weight: 600; line-height: 1.15; margin-top: 2px; }
.lc-main small { display: block; font-size: 12px; color: var(--muted); }
.lc-rows { margin: 0; display: grid; }
.lc-rows div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.lc-rows dt { color: var(--muted); } .lc-rows dd { margin: 0; font-weight: 600; }
.lc-out .flag { margin: 0; }
.order { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); }
.order span { flex: 1; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.order .btn { min-height: 34px; padding: 0 12px; }
.btn.dl { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; margin: 4px 0 6px; line-height: 40px; }
.btn.dl svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.ind p, .how p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.65; color: var(--muted); }
.ind h3 { margin: 16px 0 8px; font-size: 13px; }
.steps { margin: 10px 0 0; padding-inline-start: 22px; display: grid; gap: 8px; font-size: 13.5px; line-height: 1.6; }
.steps li::marker { color: var(--accent); font-weight: 700; }
.defs { margin: 0; display: grid; gap: 8px; }
.defs div { padding: 9px 12px; border-radius: 9px; background: var(--panel-2); }
.defs dt { font-size: 12.5px; font-weight: 700; } .defs dd { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:not(:disabled):hover { filter: brightness(1.06); }
.btn.ghost:not(:disabled):hover { border-color: var(--accent); color: var(--text); filter: none; }
.sel select { width: auto; max-width: 240px; }

/* Learn */
.le-prog { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 16px; }
.le-bar { flex: 1 1 200px; height: 8px; border-radius: 8px; background: var(--panel-3); overflow: hidden; }
.le-bar i { display: block; height: 100%; background: var(--accent); border-radius: 8px; transition: width .6s cubic-bezier(.16, 1, .3, 1); }
.le-prog span { font-size: 13px; color: var(--muted); }
.le-all { display: inline-flex; align-items: center; gap: 6px; color: var(--up) !important; font-weight: 600; font-size: 13px; margin: 0; }
.le-mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; margin-top: 8px; }
.le-mod { padding: 14px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); }
.le-mod header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.le-mod h2 { margin: 0; font-size: 15px; }
.le-mod header span { font-size: 12px; color: var(--dim); }
.le-mod ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.le-item { width: 100%; display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; padding: 10px; border: 0; border-radius: 10px; background: transparent; text-align: start; color: inherit; }
.le-item:hover, .le-item:focus-visible { background: var(--panel-2); }
.le-n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.le-t { font-size: 13.5px; font-weight: 500; line-height: 1.4; }
.le-min { font-size: 11.5px; color: var(--dim); white-space: nowrap; }
.le-ok { width: 18px; height: 18px; fill: none; stroke: var(--up); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.le-crumb { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--dim); margin-bottom: 10px; }
.le-art { max-width: 72ch; }
.le-art header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.le-art h1 { margin: 0; font-size: 22px; line-height: 1.3; flex: 1; text-wrap: balance; }
.le-art > p, .le-art > ul { font-size: 15px; line-height: 1.8; margin: 0 0 14px; }
.le-art > ul { padding-inline-start: 20px; display: grid; gap: 6px; }
.le-art > ul li::marker { color: var(--accent); }
.le-box { margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; background: var(--panel-2); }
.le-box b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
:root[lang="fa"] .le-box b { text-transform: none; letter-spacing: 0; font-size: 13px; }
.le-box p { margin: 0; font-size: 14px; line-height: 1.75; }
.le-box.ex b { color: var(--accent); } .le-box.tip b { color: var(--up); }
.le-box.warn { background: var(--warn-soft); } .le-box.warn b { color: var(--warn); }
.le-quiz { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.le-quiz h2 { margin: 0 0 10px; font-size: 16px; }
.qz { border: 0; margin: 0 0 16px; padding: 0; display: grid; gap: 6px; }
.qz legend { font-size: 14.5px; font-weight: 600; margin-bottom: 8px; line-height: 1.5; }
.qz-o { text-align: start; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 14px; }
.qz-o:not(:disabled):hover { border-color: var(--accent); }
.qz-o.right { border-color: var(--up); background: var(--up-soft); }
.qz-o.wrong { border-color: var(--down); background: var(--down-soft); }
.qz-o:disabled { cursor: default; }
.qz-fb { margin: 2px 0 0; font-size: 13px; font-weight: 600; }
.qz-fb.ok { color: var(--up); } .qz-fb.no { color: var(--down); }
.le-done-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0 18px; }
.le-nav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.le-nav .btn { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Assistant */
.ask-fab { position: fixed; z-index: 12; inset-inline-end: 18px; bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px 0 12px; border-radius: 22px; border: 0;
  background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 13.5px; box-shadow: 0 8px 24px rgba(0, 0, 0, .28); }
:root[data-kind="fx"] .ask-fab, :root[data-kind="oil"] .ask-fab { color: #fff; }
.ask-fab svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
body.locked .ask-fab, body.picking .ask-fab, body.ask-open .ask-fab, body.sheet-open .ask-fab { display: none; }
.ask-back { position: fixed; inset: 0; z-index: 19; background: rgba(0, 0, 0, .35); }
.ask { position: fixed; z-index: 20; top: 0; bottom: 0; inset-inline-end: 0; width: min(420px, 100%);
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--panel); border-inline-start: 1px solid var(--line); box-shadow: -20px 0 50px rgba(0, 0, 0, .3); animation: askIn .26s cubic-bezier(.16, 1, .3, 1); }
@keyframes askIn { from { opacity: 0; transform: translateX(24px); } }
:root[dir="rtl"] .ask { animation-name: askInR; }
@keyframes askInR { from { opacity: 0; transform: translateX(-24px); } }
.ask-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ask-id { display: flex; align-items: center; gap: 10px; }
.ask-id .logo-anim { width: 34px; height: 22px; }
.ask-id h2 { margin: 0; font-size: 15px; }
.ask-id small { font-size: 11.5px; color: var(--dim); }
.ask-log { overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.msg { max-width: 88%; display: grid; gap: 6px; }
.msg.me { align-self: flex-end; }
.msg.bot { align-self: flex-start; }
.bubble { padding: 10px 12px; border-radius: 14px; font-size: 13.5px; line-height: 1.65; }
.msg.me .bubble { background: var(--accent); color: var(--on-accent); border-end-end-radius: 4px; }
:root[data-kind="fx"] .msg.me .bubble, :root[data-kind="oil"] .msg.me .bubble { color: #fff; }
.msg.bot .bubble { background: var(--panel-2); border-end-start-radius: 4px; }
.bubble p { margin: 0 0 6px; } .bubble p:last-child { margin-bottom: 0; }
.bubble .kv { display: flex; justify-content: space-between; gap: 12px; }
.bubble .kv span { color: var(--muted); }
.bubble .warn { color: var(--warn); font-weight: 600; }
.bubble .fine { font-size: 11.5px; color: var(--dim); }
.bubble .v { font-weight: 700; }
.bubble .v.BUY { color: var(--up); } .bubble .v.NO_BUY { color: var(--down); } .bubble .v.WAIT, .bubble .v.WAIT_PULLBACK { color: var(--warn); }
.bubble .scan { margin: 4px 0 6px; padding-inline-start: 20px; display: grid; gap: 4px; }
.acts { display: flex; flex-wrap: wrap; gap: 6px; }
.act { padding: 6px 10px; border-radius: 99px; border: 1px solid var(--accent); background: transparent; color: var(--accent); font-size: 12px; font-weight: 600; }
.act:hover { background: var(--accent-soft); }
.ask-chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px; border-top: 1px solid var(--line); scrollbar-width: none; }
.ask-chips::-webkit-scrollbar { display: none; }
.chip-q { flex: none; padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 12.5px; white-space: nowrap; }
.chip-q:hover { border-color: var(--accent); }
.ask-form { display: flex; gap: 8px; padding: 10px 12px 12px; }
.ask-form input { flex: 1; min-width: 0; padding: 11px 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 14px; }
.ask-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.ask-send { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.ask-send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
:root[dir="rtl"] .ask-send svg { transform: scaleX(-1); }

/* v3 responsive */
@media (max-width: 1100px) {
  .mt5-grid { grid-template-columns: minmax(0, 1fr); }
  .mt5-grid .how, .mt5-grid .calc { grid-column: auto; grid-row: auto; }
  .scen { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .tabbar { grid-template-columns: repeat(5, 1fr); }
  .tabbar .nav-btn { font-size: 10.5px; padding: 8px 0 6px; }
  .tabbar .nav-btn svg { width: 21px; height: 21px; }
  .picker { inset-inline: 0; top: auto; bottom: 0; width: auto; max-height: 82%; border-radius: 20px 20px 0 0; padding: 0 12px calc(env(safe-area-inset-bottom, 0px) + 14px); animation: sheetUp .28s ease; }
  .picker-back { background: rgba(0, 0, 0, .45); }
  .picker-head { display: grid; grid-template-columns: 1fr auto; align-items: center; position: relative; padding: 12px 4px 0; }
  .picker-head h2 { margin: 12px 0 0; font-size: 16px; }
  .picker-head .sheet-x { margin-top: 12px; }
  .pk-row { padding: 12px 10px; }
  .ask-fab { display: none !important; }
  .ask-top { display: inline-flex !important; }
  .ask { width: 100%; border-inline-start: 0; }
  .f-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .lc-main b { font-size: 26px; }
  .sym-name { max-width: 34vw; }
  .sym-code { display: none; }
  .le-art h1 { font-size: 19px; }
}
@media (max-width: 380px) { .f-grid { grid-template-columns: 1fr; } }

@media (max-width: 420px) {
  .topbar .pill em { display: none; }
  .topbar .pill { padding: 7px; }
  .icon-btn { padding: 0 8px; }
}

/* News */
.nav-btn { position: relative; }
.nb { position: absolute; top: 3px; inset-inline-end: 8px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--down); color: #fff; font: 700 10px/17px var(--f-num); font-style: normal; text-align: center; }
.nw-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.nw-filters { display: grid; gap: 10px; margin-bottom: 12px; }
.nw-filters .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.nw-filters .chips::-webkit-scrollbar { display: none; }
.nw-filters .chips button { flex: none; }
.nw-opts { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.nw-opts .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.nw-opts .seg button { padding: 5px 10px; font-size: 12.5px; }
.nw-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-width: 860px; }
.nw-item { padding: 12px 14px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); display: grid; gap: 6px; }
.nw-item.fresh { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.nw-title[lang="fa"], .nw-sum[lang="fa"] { font-family: var(--f-fa); }
.nw-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11.5px; color: var(--dim); }
.nw-hot { padding: 1px 7px; border-radius: 99px; background: var(--down-soft); color: var(--down); font-weight: 700; font-size: 11px; }
.nw-title { color: var(--text); text-decoration: none; font-size: 15px; font-weight: 600; line-height: 1.5; }
.nw-title:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.nw-sum { margin: 0; font-size: 13px; line-height: 1.6; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nw-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nw-tags span { padding: 2px 8px; border-radius: 99px; background: var(--panel-2); font-size: 11px; color: var(--muted); font-weight: 600; }
.nw-tr { font-size: 12px; color: var(--accent); font-weight: 600; margin-inline-start: auto; }
.nw-src { max-width: 860px; margin-top: 12px; }
.cal-day { max-width: 860px; margin-bottom: 14px; }
.cal-day h2 { font-size: 13px; color: var(--muted); margin: 14px 0 6px; font-weight: 700; }
.cal-day ol { list-style: none; margin: 0; padding: 0; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); overflow: hidden; }
.cal-ev { display: grid; grid-template-columns: 48px 44px 10px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 13px; }
.cal-ev:first-child { border-top: 0; }
.cal-ev.past { opacity: .55; }
.cal-ev.next { background: var(--accent-soft); }
.cal-ev time { color: var(--muted); }
.cal-cc { padding: 2px 6px; border-radius: 6px; background: var(--panel-2); font: 700 11px var(--f-num); text-align: center; }
.cal-imp { width: 10px; height: 10px; border-radius: 50%; }
.cal-imp.hi { background: var(--down); } .cal-imp.md { background: var(--warn); }
.cal-t { font-weight: 600; min-width: 0; }
.cal-t em { display: inline-block; margin-inline-start: 8px; padding: 1px 7px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); font-style: normal; font-size: 11px; font-weight: 700; }
.cal-n { text-align: end; }
.cal-n b { display: block; font-size: 13px; }
.cal-n small { font: 500 11px var(--f-ui); color: var(--dim); white-space: nowrap; }
.flag.news { background: var(--down-soft); }
.flag.news::before { background: var(--down); }
@media (max-width: 760px) {
  .tabbar { grid-template-columns: repeat(6, 1fr); }
  .tabbar .nav-btn { font-size: 10px; }
  .tabbar .nb { inset-inline-end: 50%; margin-inline-end: -20px; top: 2px; }
  .cal-ev { grid-template-columns: 44px 40px 10px minmax(0, 1fr); gap: 8px; padding: 10px 12px; }
  .cal-n { grid-column: 4; text-align: start; }
}
.sheet-x { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--panel-2); color: var(--muted); padding: 0; }
.sheet-x:hover { color: var(--text); }
