@font-face {
  font-family: "Vazir";
  src: url("/fonts/vazir-200.woff2?v=4.7.1") format("woff2");
  font-style: normal;
  font-weight: 200;
  font-display: swap;
}

@font-face {
  font-family: "Vazir";
  src: url("/fonts/vazir-400.woff2?v=4.7.1") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Vazir";
  src: url("/fonts/vazir-500.woff2?v=4.7.1") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Vazir";
  src: url("/fonts/vazir-700.woff2?v=4.7.1") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #06101d;
  --panel: #0b1929;
  --panel-strong: #10243a;
  --line: rgba(183, 210, 224, .14);
  --text: #edf8f6;
  --muted: #91a9b7;
  --mint: #58e3b3;
  --mint-dark: #123d37;
  --gold: #f0c875;
  --red: #ff7885;
  --green: #5de2a6;
  --shadow: 0 24px 70px rgba(0, 0, 0, .28);
  --radius: 22px;
  font-family: "Vazir", Roboto, Helvetica, sans-serif;
  font-variant-numeric: tabular-nums;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 80% -10%, rgba(88, 227, 179, .12), transparent 35rem),
    radial-gradient(circle at -10% 30%, rgba(67, 126, 196, .12), transparent 30rem),
    var(--bg);
}

html[dir="ltr"] body {
  text-align: left;
}

.language-toggle {
  direction: ltr;
  min-width: 78px;
}

.login-card > .language-toggle {
  float: inline-end;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(88, 227, 179, .42);
  outline-offset: 2px;
}

.offline-banner {
  position: sticky;
  inset-block-start: 0;
  z-index: 50;
  padding: .7rem 1rem;
  color: #241a06;
  background: var(--gold);
  text-align: center;
  font-size: .84rem;
  font-weight: 700;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.2rem;
}

.offline-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.2rem;
}

.retry-link {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.login-card {
  width: min(100%, 430px);
  padding: clamp(1.5rem, 5vw, 2.6rem);
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(145deg, rgba(16, 36, 58, .95), rgba(7, 18, 31, .98));
  box-shadow: var(--shadow);
}

.brand-logo {
  width: 118px;
  height: 118px;
  display: block;
  object-fit: contain;
  margin-block-end: 1.35rem;
  border: 1px solid rgba(88, 227, 179, .55);
  border-radius: 26px;
  background: #07111f;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .26);
}

h1,
h2,
h3,
p {
  margin-block-start: 0;
}

h1 {
  margin-block-end: .8rem;
  font-size: clamp(1.4rem, 4vw, 2rem);
}

h2 {
  font-size: clamp(1.15rem, 3vw, 1.55rem);
}

h3 {
  font-size: 1rem;
}

.eyebrow {
  margin-block-end: .45rem;
  color: var(--mint);
  font: 700 .7rem/1.4 "Vazir", Roboto, Helvetica, sans-serif;
  letter-spacing: .14em;
}

.muted {
  color: var(--muted);
  line-height: 1.9;
}

.microcopy {
  margin-block-end: 0;
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.8;
}

label {
  display: grid;
  gap: .5rem;
  color: #c8d8df;
  font-size: .83rem;
}

input,
select {
  width: 100%;
  min-height: 48px;
  padding: .7rem .85rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--text);
  background: #071522;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: 1rem calc(50% - 2px), .7rem calc(50% - 2px);
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

#login-form {
  display: grid;
  gap: .8rem;
  margin-block: 1.5rem 1rem;
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button,
.icon-button {
  min-height: 44px;
  border-radius: 13px;
  padding: .65rem 1rem;
  font-weight: 700;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.primary-button {
  border: 1px solid var(--mint);
  color: #052117;
  background: var(--mint);
}

.secondary-button {
  border: 1px solid rgba(88, 227, 179, .48);
  color: var(--mint);
  background: rgba(88, 227, 179, .08);
}

.danger-button {
  border: 1px solid rgba(255, 120, 133, .65);
  color: #fff;
  background: rgba(190, 45, 66, .72);
}

.ghost-button,
.icon-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, .025);
}

.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled),
.danger-button:hover:not(:disabled),
.ghost-button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--mint);
}

.form-error {
  min-height: 1.2em;
  margin: 0;
  color: var(--red);
  font-size: .8rem;
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0 1rem calc(88px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  inset-block-start: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 78px;
  padding: .75rem 0;
  background: rgba(6, 16, 29, .86);
  backdrop-filter: blur(18px);
}

.topbar h1 {
  margin: 0;
  font-size: 1.15rem;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: .72rem;
}

.topbar-logo {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border: 1px solid rgba(88, 227, 179, .42);
  border-radius: 14px;
  object-fit: contain;
  background: #07111f;
}

.topbar .eyebrow {
  margin-block-end: .3rem;
}

.topbar-menu {
  position: relative;
  flex: 0 0 auto;
}

.menu-button {
  display: grid;
  align-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(16, 36, 58, .86);
}

.menu-button span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.menu-button[aria-expanded="true"] {
  color: var(--mint);
  border-color: rgba(88, 227, 179, .42);
}

.app-menu {
  position: absolute;
  inset-block-start: calc(100% + .55rem);
  inset-inline-end: 0;
  z-index: 40;
  display: grid;
  gap: .45rem;
  width: min(250px, calc(100vw - 2rem));
  padding: .65rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(11, 25, 41, .98);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.menu-action {
  width: 100%;
  min-height: 42px;
  padding: .65rem .8rem;
  color: var(--text);
  text-align: start;
  border: 1px solid transparent;
  border-radius: 11px;
  background: rgba(183, 210, 224, .07);
}

.menu-action:hover,
.menu-action:focus-visible {
  border-color: var(--line);
  background: rgba(183, 210, 224, .12);
}

.danger-action {
  color: var(--red);
}

.app-menu .status-pill {
  width: 100%;
}

.status-pill,
.signal,
.lock-pill,
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: .25rem .65rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
}

.status-pill {
  color: var(--mint);
  background: var(--mint-dark);
}

.status-pill.offline {
  color: var(--gold);
  background: rgba(240, 200, 117, .12);
}

.lock-pill {
  color: var(--gold);
  background: rgba(240, 200, 117, .1);
}

.signal {
  color: var(--muted);
  background: rgba(145, 169, 183, .1);
}

.signal.buy,
.signal.long {
  color: var(--green);
  background: rgba(93, 226, 166, .1);
}

.signal.sell,
.signal.short {
  color: var(--red);
  background: rgba(255, 120, 133, .1);
}

.view {
  display: none;
  padding-block: 1rem 2rem;
}

.active-view {
  display: block;
}

.hero-grid,
.trade-layout {
  display: grid;
  gap: 1rem;
}

.hero-card,
.fee-guard-card,
.trade-form,
.cost-result,
.watchlist-panel,
.symbol-card,
.analysis-card,
.live-card,
.report-card,
.position-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(16, 36, 58, .86), rgba(9, 25, 41, .94));
  box-shadow: 0 18px 42px rgba(0, 0, 0, .16);
}

.hero-card,
.fee-guard-card,
.trade-form,
.cost-result,
.watchlist-panel {
  padding: clamp(1rem, 3vw, 1.55rem);
}

.card-heading,
.section-heading,
.symbol-card-head,
.analysis-card-head,
.live-card-head,
.position-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .8rem;
}

.section-heading {
  align-items: center;
  margin-block: 1.7rem .85rem;
}

.signal-heading-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: .35rem;
}

.section-actions,
.symbol-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.symbol-suggestions {
  margin-block: .65rem 1rem;
}

.symbol-chip {
  min-height: 34px;
  padding: .35rem .65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--mint);
  background: rgba(88, 227, 179, .06);
  font: 700 .72rem/1 "Vazir", Roboto, Helvetica, sans-serif;
  direction: ltr;
}

.symbol-code {
  direction: ltr;
  unicode-bidi: isolate;
}

.symbol-correction {
  margin-block: .8rem;
  padding: .8rem;
  border: 1px solid rgba(240, 200, 117, .35);
  border-radius: 14px;
  background: rgba(240, 200, 117, .07);
}

.chart-shell {
  position: relative;
  margin-block-start: 1rem;
  border: 1px solid rgba(183, 210, 224, .16);
  border-radius: 18px;
  background: #07131f;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025);
  overflow: hidden;
}

.candlestick-chart {
  display: block;
  width: 100%;
  height: 420px;
  touch-action: pan-y;
}

.chart-tooltip {
  position: absolute;
  z-index: 2;
  min-width: 160px;
  padding: .55rem .65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: rgba(4, 13, 23, .94);
  box-shadow: var(--shadow);
  font-size: .72rem;
  line-height: 1.75;
  pointer-events: none;
  white-space: pre-line;
}

.chart-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .8rem;
  min-height: 52px;
  padding: .7rem .85rem;
  border-block-end: 1px solid rgba(183, 210, 224, .12);
  background: rgba(4, 14, 24, .78);
  color: var(--muted);
  font-size: .72rem;
}

.chart-identity {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .55rem;
}

.chart-identity strong {
  color: var(--text);
  font-size: .82rem;
}

.chart-resolution {
  padding: .22rem .48rem;
  border: 1px solid rgba(183, 210, 224, .16);
  border-radius: 7px;
  color: #c8d8df;
  background: rgba(183, 210, 224, .06);
}

.chart-stream-state {
  font-weight: 700;
}

.chart-ohlc {
  direction: ltr;
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
  text-align: start;
}

.live-trade-chart {
  margin-block-start: .85rem;
}

.section-heading h2,
.section-heading h3,
.card-heading h2 {
  margin: 0;
}

.compact-heading {
  margin-block-start: 1.2rem;
}

.hero-price {
  margin: 1.2rem 0;
  font: 700 clamp(2rem, 7vw, 3.4rem)/1 "Vazir", Roboto, Helvetica, sans-serif;
  letter-spacing: -.03em;
}

.metric-row,
.cost-grid,
.report-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .6rem;
}

.metric-row > div,
.cost-grid > div,
.report-metrics > div {
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, .11);
}

.metric-row span,
.cost-grid span,
.report-metrics span {
  display: block;
  margin-block-end: .35rem;
  color: var(--muted);
  font-size: .7rem;
}

.metric-row strong,
.cost-grid strong,
.report-metrics strong {
  font-size: .9rem;
}

.fee-guard-card {
  position: relative;
  overflow: hidden;
}

.fee-guard-card::after {
  position: absolute;
  content: "";
  width: 160px;
  height: 160px;
  inset-inline-end: -70px;
  inset-block-start: -70px;
  border-radius: 50%;
  background: rgba(88, 227, 179, .08);
}

.fee-shield {
  display: inline-block;
  margin-block-end: 1rem;
  padding: .38rem .7rem;
  border: 1px solid rgba(88, 227, 179, .35);
  border-radius: 10px;
  color: var(--mint);
  font-size: .78rem;
  font-weight: 700;
}

.fee-guard-card p {
  color: var(--muted);
  line-height: 1.9;
}

.fee-highlight {
  margin-block: 1rem;
  padding: 1rem;
  border-inline-start: 3px solid var(--mint);
  background: rgba(88, 227, 179, .06);
}

.fee-highlight span {
  display: block;
  margin-block-end: .3rem;
  color: var(--muted);
  font-size: .7rem;
}

.symbol-grid,
.report-grid,
.live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: .8rem;
}

.symbol-card,
.analysis-card,
.live-card,
.report-card,
.position-card {
  padding: 1rem;
}

.symbol-card h3,
.analysis-card h3,
.position-card h3 {
  margin-block-end: .35rem;
}

.recommendation-box {
  display: grid;
  gap: .5rem;
  margin-block: .75rem;
  padding: .8rem;
  border: 1px solid rgba(54, 201, 143, .35);
  border-radius: 14px;
  background: rgba(54, 201, 143, .08);
}

.symbol-price {
  margin: .9rem 0 .4rem;
  font: 700 1.35rem/1 "Vazir", Roboto, Helvetica, sans-serif;
}

.live-grid {
  margin-block-start: 1rem;
  grid-template-columns: minmax(0, 1fr);
}

.live-card h3 {
  margin-block-end: .35rem;
}

.live-price {
  margin: .85rem 0 .35rem;
  font: 700 clamp(1.55rem, 5vw, 2.25rem)/1 "Vazir", Roboto, Helvetica, sans-serif;
  direction: ltr;
  text-align: start;
}

.live-chart-shell {
  position: relative;
  margin-block-start: .85rem;
  padding: .45rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #071522;
  overflow: hidden;
}

.live-line-chart {
  display: block;
  width: 100%;
  height: 280px;
  touch-action: pan-y;
}

.stack-list {
  display: grid;
  gap: .75rem;
}

.analysis-card p,
.position-card p {
  margin-block-end: .5rem;
}

.watchlist-panel {
  margin-block-start: 1rem;
}

.inline-form {
  display: grid;
  gap: .7rem;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-block-end: 1rem;
}

.watchlist-table {
  display: grid;
  gap: .5rem;
}

.watchlist-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: .5rem;
  padding: .7rem;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.small-button {
  min-height: 34px;
  padding: .35rem .65rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  background: transparent;
  font-size: .72rem;
}

.trade-form {
  align-self: start;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  margin-block: 1.2rem .7rem;
}

.cost-result {
  min-height: 250px;
}

.empty-state {
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  line-height: 2;
}

.cost-result h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
}

.cost-grid {
  grid-template-columns: repeat(2, 1fr);
}

.cost-total {
  margin-block: 1rem;
  padding: 1rem;
  border: 1px solid rgba(88, 227, 179, .25);
  border-radius: 15px;
  background: rgba(88, 227, 179, .06);
}

.cost-total strong {
  display: block;
  margin-block-start: .25rem;
  font-size: 1.2rem;
}

.warning-list {
  margin: .8rem 0 0;
  padding-inline-start: 1.3rem;
  color: var(--gold);
  font-size: .78rem;
  line-height: 1.9;
}

.confirm-dialog {
  width: min(620px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 1px solid rgba(255, 120, 133, .4);
  border-radius: 22px;
  color: var(--text);
  background: #0b1b2a;
  box-shadow: var(--shadow);
}

.confirm-dialog::backdrop {
  background: rgba(1, 7, 13, .82);
  backdrop-filter: blur(6px);
}

.confirm-card {
  padding: 1.2rem;
}

.confirmation-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
}

.confirmation-summary > div {
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, .025);
}

.confirmation-summary span,
.confirmation-summary strong {
  display: block;
}

.confirmation-summary span {
  color: var(--muted);
  font-size: .72rem;
}

.warning-box {
  margin-block: 1rem 0;
  padding: .85rem;
  border: 1px solid rgba(240, 200, 117, .32);
  border-radius: 14px;
  color: var(--gold);
  background: rgba(240, 200, 117, .07);
  line-height: 1.9;
}

.positive {
  color: var(--green) !important;
}

.negative {
  color: var(--red) !important;
}

.neutral-text {
  color: var(--gold) !important;
}

.report-card h3 {
  margin-block-end: .8rem;
}

.report-metrics {
  grid-template-columns: repeat(2, 1fr);
}

.toast {
  position: fixed;
  z-index: 100;
  inset-inline: 1rem;
  inset-block-end: calc(84px + env(safe-area-inset-bottom));
  max-width: 430px;
  margin-inline: auto;
  padding: .8rem 1rem;
  border: 1px solid rgba(88, 227, 179, .32);
  border-radius: 14px;
  color: var(--text);
  background: #12362f;
  box-shadow: var(--shadow);
  text-align: center;
  font-size: .84rem;
}

.toast.error {
  border-color: rgba(255, 120, 133, .35);
  background: #401d27;
}

.bottom-nav {
  position: fixed;
  z-index: 30;
  inset-inline: 0;
  inset-block-end: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .3rem;
  padding: .55rem max(1rem, calc((100vw - 1150px) / 2)) calc(.55rem + env(safe-area-inset-bottom));
  border-block-start: 1px solid var(--line);
  background: rgba(6, 16, 29, .94);
  backdrop-filter: blur(20px);
}

.nav-button {
  min-height: 48px;
  border: 0;
  border-radius: 13px;
  color: var(--muted);
  background: transparent;
  font-size: .76rem;
}

.nav-button.active {
  color: var(--mint);
  background: rgba(88, 227, 179, .08);
}

.trade-nav {
  border: 1px solid rgba(88, 227, 179, .18);
}

@media (min-width: 800px) {
  .app-shell {
    padding-inline: 1.5rem;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  }

  .trade-layout {
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
  }

  .bottom-nav {
    position: sticky;
    inset-block-end: 1rem;
    width: min(620px, 100%);
    margin: 0 auto;
    padding: .5rem;
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
  }

  .toast {
    inset-block-end: 2rem;
  }
}

@media (max-width: 620px) {
  .field-grid,
  .metric-row,
  .confirmation-summary {
    grid-template-columns: 1fr;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .watchlist-row {
    grid-template-columns: 1fr auto;
  }

  .watchlist-row strong {
    grid-column: 1 / -1;
  }

  .form-actions > button {
    flex: 1 1 100%;
  }

  .candlestick-chart {
    height: 360px;
  }

  .chart-legend {
    align-items: flex-start;
  }

  .chart-ohlc {
    flex-basis: 100%;
    overflow: hidden;
    font-size: .68rem;
    white-space: nowrap;
  }
}

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