@font-face {
  font-family: 'Vazirmatn';
  src: url('/assets/vazirmatn.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e3e6eb;
  --text: #1b1f27;
  --muted: #667085;
  --accent: #3b5bdb;
  --pos: #12855a;
  --pos-bg: #e6f5ee;
  --neg: #c2362f;
  --neg-bg: #fbeceb;
  --warn: #a8670a;
  --warn-bg: #fdf3e2;
  --neu: #5b6475;
  --neu-bg: #eef0f3;
  --grid: #e9ecf0;
  --sma20: #e67700;
  --sma50: #3b5bdb;
  --sma200: #9c36b5;
  --ch1: #0b8ca3;
  --ch2: #c2255c;
  --nav: #5f3dc4;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218;
    --surface: #171b23;
    --surface-2: #1f2430;
    --border: #2a303c;
    --text: #e6e8ec;
    --muted: #98a1b2;
    --accent: #7c95ff;
    --pos: #3ecf8e;
    --pos-bg: #13291f;
    --neg: #ff6b62;
    --neg-bg: #2e1715;
    --warn: #f2b14c;
    --warn-bg: #2d2311;
    --neu: #a3abba;
    --neu-bg: #222733;
    --grid: #232935;
    --sma20: #ffa94d;
    --sma50: #7c95ff;
    --sma200: #da77f2;
    --ch1: #3bc9db;
    --ch2: #f783ac;
    --nav: #b197fc;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  font-size: 15px;
}
a { color: var(--accent); text-decoration: none; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
h1, h2, h3 { line-height: 1.4; margin: 0; }

/* header */
.top { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.top-inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { font-weight: 800; font-size: 17px; color: var(--text); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.logo { color: var(--accent); }
.search { position: relative; flex: 1; max-width: 520px; }
.search input, .login-card input {
  width: 100%; font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 14px; outline: none;
}
.search input:focus, .login-card input:focus { border-color: var(--accent); }
.logout { color: var(--muted); font-size: 14px; margin-inline-start: auto; }
.results {
  position: absolute; top: calc(100% + 6px); inset-inline: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px rgb(0 0 0 / 0.12);
  max-height: 60vh; overflow: auto; padding: 6px;
}
.results button {
  display: flex; width: 100%; gap: 10px; align-items: baseline; text-align: start; font: inherit; color: var(--text);
  background: none; border: 0; border-radius: 8px; padding: 8px 10px; cursor: pointer;
}
.results button:hover, .results button.active { background: var(--surface-2); }
.results b { min-width: 70px; }
.results .market { margin-inline-start: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }

/* layout */
main { padding: 24px 16px 8px; }
.empty { text-align: center; padding: 70px 0; max-width: 640px; margin: 0 auto; }
.empty h1 { font-size: 26px; margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; grid-column: span 12; min-width: 0; }
.card h2 { font-size: 16px; margin-bottom: 12px; }
.span-6 { grid-column: span 6; }
.span-4 { grid-column: span 4; }
.span-8 { grid-column: span 8; }
@media (max-width: 860px) { .span-6, .span-4, .span-8 { grid-column: span 12; } }

/* title block */
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.head h1 { font-size: 24px; }
.head .sub { color: var(--muted); font-size: 14px; }
.price-big { font-size: 28px; font-weight: 800; }
.chg { font-size: 15px; font-weight: 700; margin-inline-start: 8px; }
.up { color: var(--pos); }
.down { color: var(--neg); }
.pill { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 13px; background: var(--neu-bg); color: var(--neu); }

/* verdict */
.verdict { display: flex; gap: 20px; align-items: flex-start; }
.badge { flex: none; border-radius: 12px; padding: 12px 18px; text-align: center; min-width: 130px; }
.badge .lbl { font-size: 13px; opacity: 0.85; }
.badge .val { font-size: 22px; font-weight: 800; }
.tone-pos { background: var(--pos-bg); color: var(--pos); }
.tone-neg { background: var(--neg-bg); color: var(--neg); }
.tone-neu { background: var(--neu-bg); color: var(--neu); }
.tone-warn { background: var(--warn-bg); color: var(--warn); }
.summary { margin: 0; }
@media (max-width: 600px) { .verdict { flex-direction: column; } .badge { width: 100%; } }

.signals { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.signals li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); }
.signals .dot { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; margin-top: 3px; }

/* tables */
.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
.kv td { padding: 7px 0; border-bottom: 1px solid var(--border); }
.kv tr:last-child td { border-bottom: 0; }
.kv td:last-child { text-align: left; font-weight: 600; }
.levels { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.levels h3 { font-size: 14px; margin-bottom: 6px; }
.levels ul { margin: 0; padding: 0; list-style: none; font-size: 14px; }
.levels li { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed var(--border); }

/* charts */
.chart-wrap { position: relative; }
.chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-info { font-size: 13px; color: var(--muted); min-height: 24px; direction: rtl; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-inline-end: 5px; }

.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg button { font: inherit; font-size: 13px; color: var(--muted); background: none; border: 0; border-radius: 7px; padding: 3px 12px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 700; box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }

/* channels */
.channels { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.channel h3 { font-size: 15px; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.channel h3 i { width: 16px; height: 4px; border-radius: 2px; display: inline-block; }
.pos-bar { position: relative; height: 8px; border-radius: 4px; margin-top: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.pos-bar span { position: absolute; top: -4px; width: 4px; height: 16px; border-radius: 2px; background: var(--text); transform: translateX(50%); }
.pos-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* report date */
.asof-box { position: relative; flex: none; width: 200px; }
.asof-box input, .asof-box select { width: 100%; font: inherit; font-size: 14px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; outline: none; }
.asof-box input { text-align: center; }
.asof-box input:focus, .asof-box select:focus { border-color: var(--accent); }
.asof-box input.bad { border-color: var(--neg); }

/* chart controls */
.chart-tools { display: flex; gap: 8px; flex-wrap: wrap; }
#zoom button { font-size: 15px; padding: 1px 11px; }
.toggles button { font: inherit; font-size: 12.5px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.toggles button i { margin: 0; }
.toggles button.off { color: var(--muted); opacity: 0.55; text-decoration: line-through; }
#cwrap { cursor: grab; touch-action: pan-y; user-select: none; }
#cwrap:active { cursor: grabbing; }

/* turning points */
.gauge { margin: 4px 0 12px; }
.gauge-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--surface-2); }
.gauge-bar .g-bottom { background: var(--pos); }
.gauge-bar .g-top { background: var(--neg); }
.gauge-labels { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; margin-top: 4px; }
.grid-table.pivots td, .grid-table.pivots th { white-space: nowrap; }
.detail-row td { padding: 0 8px 6px; border-bottom: 1px solid var(--border); }
.detail-row summary { cursor: pointer; font-size: 12.5px; color: var(--accent); }
table.mini { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 6px 0; }
table.mini th, table.mini td { padding: 3px 6px; border-bottom: 1px dashed var(--border); text-align: start; white-space: nowrap; }
table.mini tr.pivot-day td { background: var(--surface-2); font-weight: 700; }
.card.asof { border-color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 10px 0; }
.stats > div { background: var(--surface-2); border-radius: 10px; padding: 8px 12px; display: grid; gap: 2px; }
.stats span { font-size: 12.5px; color: var(--muted); }
.stats b { font-size: 17px; }
.stats small { font-size: 12px; color: var(--muted); }
.signals .sec { margin-inline-start: auto; flex: none; font-size: 11.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; align-self: center; }
.home-h { font-size: 16px; margin: 30px 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 5px 14px; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.refresh { font: inherit; font-size: 13px; color: var(--accent); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 3px 12px; cursor: pointer; }
.refresh:disabled { opacity: 0.7; cursor: default; }
.sub-h { font-size: 14px; margin: 16px 0 6px; }
.fund-intro { margin: 0 0 10px; }
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 52px; align-items: center; gap: 10px; font-size: 13.5px; }
.bar-row b { text-align: left; font-weight: 600; }
.bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.table-scroll { overflow-x: auto; }
.grid-table { width: 100%; border-collapse: collapse; font-size: 13.5px; white-space: nowrap; }
.grid-table th { text-align: start; font-weight: 600; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.grid-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.grid-table tr.dim td { opacity: 0.6; }
.spark { width: 120px; height: 28px; display: block; }
@media (max-width: 700px) {
  .top-inner { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .asof-box { margin-inline-start: auto; }
  .bar-row { grid-template-columns: 100px 1fr 48px; }
}

/* codal */
.letters { list-style: none; margin: 0; padding: 0; }
.letters li { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.letters li:last-child { border-bottom: 0; }
.letters .date { color: var(--muted); white-space: nowrap; font-size: 13px; }
.letters .kind { flex: none; }

.loading { text-align: center; padding: 80px 0; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; margin: 0 auto 14px; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.mini-spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -1px; margin-inline-end: 6px; }
.error { background: var(--neg-bg); color: var(--neg); padding: 14px 18px; border-radius: 12px; }
.foot { font-size: 12.5px; padding: 18px 16px 30px; }
.note { font-size: 13px; color: var(--muted); margin-top: 10px; }

/* login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; width: 100%; max-width: 360px; display: grid; gap: 12px; }
.login-card p { margin: 0; }
.login-card button { font: inherit; font-weight: 700; background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 10px; cursor: pointer; }
.err { color: var(--neg); }

@media (max-width: 600px) {
  .top-inner { gap: 10px; }
  .brand .txt { display: none; }
  .price-big { font-size: 24px; }
}
