/* متاسهم — web app v0.8. Own design system: emerald brand, navy ink, quiet surfaces; RTL, light/dark, responsive. */
@font-face { font-family: "MS"; src: url(fonts/Vazirmatn-UI-FD-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "MS"; src: url(fonts/Vazirmatn-UI-FD-Medium.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "MS"; src: url(fonts/Vazirmatn-UI-FD-Bold.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "MSL"; src: url(fonts/Vazirmatn-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
:root {
  --brand: #0E7C66; --brand-2: #12A386; --brand-soft: #E2F4EE; --ink: #101626; --bg: #F2F4F8; --surface: #FFFFFF; --surface-2: #F7F8FB;
  --line: #E3E7EF; --fg: #141A2A; --mut: #667085; --up: #0F8A5F; --up-soft: #E3F5EC; --down: #D33A3A; --down-soft: #FCEBEB; --warn: #C98A12; --warn-soft: #FFF4D9;
  --shadow: 0 1px 2px rgba(16,22,38,.04), 0 6px 24px rgba(16,22,38,.05); --r: 16px; --r-s: 10px; color-scheme: light;
}
:root[data-theme="dark"] {
  --brand: #22B395; --brand-2: #2BD0AE; --brand-soft: #123A33; --ink: #E8EDF7; --bg: #0B1020; --surface: #121A2E; --surface-2: #17213A;
  --line: #22304D; --fg: #E6EBF5; --mut: #8E9AB3; --up: #2FC48A; --up-soft: #12342A; --down: #F06464; --down-soft: #3A1C24; --warn: #E3AE3C; --warn-soft: #3A2E14;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 30px rgba(0,0,0,.25); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: MS, Tahoma, sans-serif; background: var(--bg); color: var(--fg); font-size: 14px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-feature-settings: "tnum"; direction: ltr; unicode-bidi: isolate; display: inline-block; }
td.num, th.num { display: table-cell; direction: ltr; text-align: inherit; }
.up { color: var(--up); } .down { color: var(--down); } .mut { color: var(--mut); } .sm { font-size: 12px; } .xs { font-size: 11px; }
.b { font-weight: 700; } .m { font-weight: 500; }
/* ------------------------------------------------ shell */
.top { position: sticky; top: 0; z-index: 40; height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 20px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; letter-spacing: -.3px; white-space: nowrap; }
.logo i { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); position: relative; flex-shrink: 0; }
.logo i::after { content: ""; position: absolute; inset: 7px 6px 6px 7px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: skew(-12deg); border-radius: 0 0 0 3px; }
.search { flex: 1; max-width: 460px; position: relative; }
.search input { width: 100%; height: 40px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 0 38px 0 12px; outline: none; }
.search input:focus { border-color: var(--brand); background: var(--surface); }
.search::before { content: "⌕"; position: absolute; right: 12px; top: 7px; color: var(--mut); font-size: 18px; }
.sr { position: absolute; top: 46px; inset-inline: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-height: 380px; overflow: auto; display: none; z-index: 50; }
.sr.on { display: block; } .sr a { display: flex; justify-content: space-between; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line); } .sr a:hover, .sr a.hl { background: var(--surface-2); }
.sp { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; white-space: nowrap; }
.pill .d { width: 8px; height: 8px; border-radius: 50%; background: var(--mut); }
.pill.live .d { background: var(--up); box-shadow: 0 0 0 0 rgba(15,138,95,.5); animation: pulse 1.6s infinite; } .pill.stale .d { background: var(--warn); } .pill.err .d { background: var(--down); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(15,138,95,.45); } 70% { box-shadow: 0 0 0 8px rgba(15,138,95,0); } 100% { box-shadow: 0 0 0 0 rgba(15,138,95,0); } }
.ibtn { width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; font-size: 16px; }
.ibtn:hover { border-color: var(--brand); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 11px; border: 0; background: var(--brand); color: #fff; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { filter: brightness(1.06); } .btn:disabled { opacity: .55; cursor: default; }
.btn.o { background: var(--surface); color: var(--fg); border: 1px solid var(--line); } .btn.o:hover { border-color: var(--brand); color: var(--brand); }
.btn.s { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; } .btn.r { background: var(--down); } .btn.ghost { background: transparent; color: var(--brand); padding: 0 8px; }
.layout { display: flex; min-height: calc(100vh - 60px); }
/* v0.8: the side column keeps its surface + border down the whole page (the nav itself is sticky, viewport-high) */
@media (min-width: 821px) { .layout { background: linear-gradient(to left, var(--surface) 220px, var(--line) 220px, var(--line) 221px, transparent 221px); } }
.nav { width: 220px; flex-shrink: 0; align-self: flex-start; padding: 16px 12px; position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto; border-left: 1px solid var(--line); background: var(--surface); }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 11px; color: var(--mut); margin-bottom: 2px; font-weight: 500; }
.nav a svg { width: 19px; height: 19px; flex-shrink: 0; } .nav a:hover { background: var(--surface-2); color: var(--fg); }
.nav a.on { background: var(--brand-soft); color: var(--brand); }
.nav .h { font-size: 11px; color: var(--mut); margin: 16px 12px 6px; opacity: .8; }
.nav .foot { margin-top: 20px; padding: 12px; border-radius: 12px; background: var(--surface-2); font-size: 12px; color: var(--mut); }
main { flex: 1; min-width: 0; padding: 22px 26px 90px; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-h h1 { font-size: 22px; margin: 0; letter-spacing: -.3px; } .page-h p { margin: 2px 0 0; color: var(--mut); }
.banner { margin: 0 0 16px; padding: 10px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 13px; border: 1px dashed color-mix(in srgb, var(--warn) 50%, transparent); }
.banner.err { background: var(--down-soft); color: var(--down); }
.bnav { display: none; }
/* ------------------------------------------------ cards & grids */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { margin: 0 0 12px; font-size: 14.5px; display: flex; align-items: center; gap: 8px; } .card h3 .sp { flex: 1; } .card h3 small { font-weight: 400; color: var(--mut); }
.g { display: grid; gap: 16px; } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.mb { margin-bottom: 16px; }
.kpi .l { color: var(--mut); font-size: 12.5px; } .kpi .v { font-size: 22px; font-weight: 700; margin-top: 2px; letter-spacing: -.3px; } .kpi .c { font-size: 12.5px; margin-top: 2px; }
.idx-card { position: relative; overflow: hidden; padding-bottom: 54px; } .idx-card .spark { position: absolute; inset: auto 0 0 0; height: 42px; opacity: .9; pointer-events: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 30px; padding: 0 12px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--mut); white-space: nowrap; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--surface); } :root[data-theme="dark"] .chip.on { background: var(--brand); border-color: var(--brand); color: #04110d; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; }
.seg button { height: 28px; padding: 0 12px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; color: var(--mut); font-size: 12.5px; }
.seg button.on { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.08); font-weight: 500; }
/* breadth bar */
.breadth { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--surface-2); margin: 8px 0 6px; }
.breadth i { display: block; } .breadth .p { background: var(--up); } .breadth .n { background: var(--down); } .breadth .z { background: var(--mut); opacity: .35; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.kv > div { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; } .kv > div span:first-child { color: var(--mut); }
/* ------------------------------------------------ tables */
.tw { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; }
.t th { position: sticky; top: 0; background: var(--surface); color: var(--mut); font-weight: 500; font-size: 12px; text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; }
.t th.n, .t td.n { text-align: left; } .t th .ar { opacity: .6; font-size: 10px; }
.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 13px; }
.t tr:hover td { background: var(--surface-2); } .t tr[data-href] { cursor: pointer; }
.t td .sym { font-weight: 700; } .t td .nm { color: var(--mut); font-size: 11.5px; display: block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.flash-up { animation: fu 1.1s ease-out; } .flash-down { animation: fd 1.1s ease-out; }
@keyframes fu { from { background: var(--up-soft); } to { background: transparent; } } @keyframes fd { from { background: var(--down-soft); } to { background: transparent; } }
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 20px; background: var(--surface-2); color: var(--mut); border: 1px solid var(--line); }
.tag.up { background: var(--up-soft); color: var(--up); border-color: transparent; } .tag.down { background: var(--down-soft); color: var(--down); border-color: transparent; } .tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pct { display: inline-block; min-width: 62px; text-align: center; padding: 2px 8px; border-radius: 8px; font-size: 12.5px; font-weight: 500; direction: ltr; }
.pct.up { background: var(--up-soft); } .pct.down { background: var(--down-soft); } .pct.z { background: var(--surface-2); color: var(--mut); }
/* ------------------------------------------------ symbol board */
.board-h { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.board-h .sym { font-size: 26px; font-weight: 700; letter-spacing: -.4px; } .board-h .name { color: var(--mut); }
.price-big { font-size: 30px; font-weight: 700; letter-spacing: -.5px; }
.ob { width: 100%; border-collapse: collapse; } .ob td, .ob th { padding: 6px 8px; font-size: 12.5px; text-align: center; position: relative; } .ob th { color: var(--mut); font-weight: 500; font-size: 11.5px; }
.ob td.bid { color: var(--up); } .ob td.ask { color: var(--down); } .ob .bar { position: absolute; top: 3px; bottom: 3px; border-radius: 4px; opacity: .14; z-index: 0; }
.ob td > span { position: relative; z-index: 1; } .ob .bar.b { background: var(--up); left: 0; } .ob .bar.a { background: var(--down); right: 0; }
.ctbar { display: flex; height: 26px; border-radius: 8px; overflow: hidden; font-size: 11.5px; } .ctbar div { display: flex; align-items: center; justify-content: center; color: #fff; min-width: 0; overflow: hidden; }
.ctbar .i { background: var(--brand); } .ctbar .n { background: #6E7FA8; }
.chart-wrap { position: relative; height: 420px; } .chart-wrap.sm { height: 260px; } .chart-wrap.xs { height: 180px; }
.chart-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.legend { position: absolute; top: 6px; right: 10px; z-index: 3; font-size: 12px; background: color-mix(in srgb, var(--surface) 80%, transparent); padding: 3px 8px; border-radius: 8px; pointer-events: none; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px 0 14px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--mut); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs button.on { color: var(--brand); border-color: var(--brand); }
/* ------------------------------------------------ forms */
.f { display: grid; gap: 12px; } .f.cols { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.f label { display: block; font-size: 12px; color: var(--mut); margin-bottom: 4px; }
.in, .f input, .f select, .f textarea { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); outline: none; }
.f textarea { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; }
.code { font-family: ui-monospace, Menlo, Consolas, MSL, monospace; direction: ltr; text-align: left; font-size: 13px; }
.in:focus, .f input:focus, .f select:focus, .f textarea:focus { border-color: var(--brand); }
.err-box { background: var(--down-soft); color: var(--down); border-radius: 11px; padding: 9px 12px; font-size: 13px; }
.ok-box { background: var(--up-soft); color: var(--up); border-radius: 11px; padding: 9px 12px; font-size: 13px; }
.help-list { max-height: 420px; overflow: auto; } .help-list div { padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px; cursor: pointer; }
.help-list div:hover { color: var(--brand); } .help-list code { direction: ltr; display: inline-block; font-size: 12px; color: var(--brand); }
.empty { text-align: center; padding: 36px 10px; color: var(--mut); } .empty b { display: block; color: var(--fg); font-size: 15px; margin-bottom: 4px; }
.skel { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; min-height: 14px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 12px; z-index: 90; box-shadow: var(--shadow); font-size: 13px; }
.modal-bg { position: fixed; inset: 0; background: rgba(8,12,24,.45); z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 18px; width: min(460px, 100%); padding: 20px 22px; box-shadow: var(--shadow); max-height: 90vh; overflow: auto; }
.modal h2 { margin: 0 0 14px; font-size: 17px; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.foot-note { color: var(--mut); font-size: 11.5px; margin-top: 18px; text-align: center; }
.plan { border: 1px solid var(--line); border-radius: 14px; padding: 14px; } .plan.on { border-color: var(--brand); background: var(--brand-soft); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .nav { display: none; } main { padding: 14px 12px 90px; } .g2, .g3 { grid-template-columns: 1fr; } .top { padding: 0 12px; gap: 8px; } .logo span { display: none; }
  .hide-m { display: none !important; } .kv { grid-template-columns: 1fr; }
  .bnav { display: flex; position: fixed; bottom: 0; inset-inline: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line); height: 62px; padding-bottom: env(safe-area-inset-bottom); }
  .bnav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10.5px; color: var(--mut); }
  .bnav a svg { width: 21px; height: 21px; } .bnav a.on { color: var(--brand); }
  .chart-wrap { height: 320px; } .price-big { font-size: 24px; }
}
