/* ==========================================================================
   Cafe Option – Unified UI (Component-first, Dark-friendly)
   - Single design system (tokens) with optional light mode
   - Sticky top navigation (works with existing .header-container)
   - Reduced eye fatigue: soft contrast, no pure black/white
   - Backward-compatible class aliases for current templates
   ========================================================================== */

/* =========================
   Reset / Box Model
========================= */
*,
*::before,
*::after { box-sizing: border-box; }

html { direction: rtl; }
body { margin: 0; }

/* =========================
   Fonts – Vazir (FD)
========================= */
@font-face {
  font-family: "Vazir";
  src: url("/static/fonts/Vazir-FD-WOL.woff2") format("woff2"),
       url("/static/fonts/Vazir-FD-WOL.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Vazir";
  src: url("/static/fonts/Vazir-Medium-FD-WOL.woff2") format("woff2"),
       url("/static/fonts/Vazir-Medium-FD-WOL.woff") format("woff");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Vazir";
  src: url("/static/fonts/Vazir-Bold-FD-WOL.woff2") format("woff2"),
       url("/static/fonts/Vazir-Bold-FD-WOL.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Vazir";
  src: url("/static/fonts/Vazir-Light-FD-WOL.woff2") format("woff2"),
       url("/static/fonts/Vazir-Light-FD-WOL.woff") format("woff");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Vazir";
  src: url("/static/fonts/Vazir-Thin-FD-WOL.woff2") format("woff2"),
       url("/static/fonts/Vazir-Thin-FD-WOL.woff") format("woff");
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}

/* =========================
   Design Tokens (Default: Dark-friendly)
   To force light mode:
   <html data-theme="light">
========================= */
:root{
  /* Typography */
  --font: "Vazir", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-16: 16px;
  --fs-18: 18px;
  --fs-20: 20px;
  --lh: 1.85;

  /* Layout */
  --container: 1200px;
  --pad: 16px;
  --pad-sm: 12px;

  /* Radius */
  --r-xs: 10px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 18px;

  /* Brand */
  --primary: #22c55e;         /* Brand primary */
  --secondary: #38bdf8;       /* Brand secondary */
  --primary-soft: rgba(34,197,94,.16);
  --secondary-soft: rgba(56,189,248,.14);

  /* Dark surfaces (soft, not pure black) */
  --bg: #0b1220;
  --surface: #111a2e;
  --surface-2: #0f172a;
  --surface-3: rgba(255,255,255,.03);

  /* Text */
  --text: #e5e7eb;
  --muted: rgba(229,231,235,.68);
  --text-strong: #ffffff;

  /* Borders / dividers */
  --border: rgba(255,255,255,.10);
  --border-strong: rgba(255,255,255,.16);

  /* Shadows */
  --shadow: 0 10px 26px rgba(0,0,0,.35);
  --shadow-soft: 0 6px 18px rgba(0,0,0,.25);

  /* Focus ring */
  --focus: rgba(56,189,248,.28);

  /* Status */
  --ok: #16a34a;
  --warn: #f59e0b;
  --bad: #ef4444;

  /* Inputs */
  --input-bg: #0f172a;
  --input-text: #e5e7eb;
  --input-placeholder: rgba(229,231,235,.55);

  /* Tables */
  --table-head: rgba(255,255,255,.04);
  --row-hover: rgba(255,255,255,.03);

  /* Topbar */
  --topbar-bg: rgba(11,18,32,.78);
  --topbar-blur: blur(10px);
  --topbar-height: 64px;
}

/* Light theme override (optional) */
html[data-theme="light"]{
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: rgba(15,23,42,.02);

  --text: #0f172a;
  --muted: rgba(15,23,42,.62);
  --text-strong: #0b1220;

  --border: #e5e7eb;
  --border-strong: #d1d5db;

  --shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 6px 18px rgba(15, 23, 42, 0.06);

  --input-bg: #ffffff;
  --input-text: #111827;
  --input-placeholder: #9ca3af;

  --table-head: #f2f2f2;
  --row-hover: rgba(37,99,235,.06);

  --topbar-bg: rgba(245,246,251,.78);
  --topbar-blur: blur(8px);
}

/* =========================
   Base / Global
========================= */
html, body{
  font-family: var(--font);
  font-size: var(--fs-14);
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body{
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a{
  color: var(--secondary);
  text-decoration: none;
}
a:hover{ text-decoration: underline; }

h1,h2,h3,h4{ color: var(--text-strong); margin: 0; }
h1{ font-size: 22px; }
h2{ font-size: 18px; }
h3{ font-size: 16px; }

.muted{ color: var(--muted); }
.text-rtl{ text-align: right; }

/* Numeric alignment (readable in tables) */
.num{
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* Utility colors (backward compat) */
.blue { color: #2563eb; }
.green{ color: var(--ok); }
.red  { color: var(--bad); }

/* =========================
   Layout Shell (Back-Compat)
========================= */
.page-shell{
  min-height: 100vh;
  padding: 20px 24px;
}
@media (max-width: 768px){
  .page-shell{ padding: 12px; }
}

/* A simple centered container (optional use) */
.container{
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* =========================
   Top Navigation (Sticky)
   - Works with existing .header-container markup
   - For a true topbar, wrap header in <header class="topbar">
========================= */
.topbar{
  position: sticky;
  top: 0;
  z-index: 1100;
  background: var(--topbar-bg);
  backdrop-filter: var(--topbar-blur);
  border-bottom: 1px solid var(--border);
}

/* Backward compatible header container */
.header-container{
  position: sticky;
  top: 12px; /* change to 0 if you want flush */
  z-index: 1050;

  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  gap: 16px;

  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  flex-wrap: wrap;
}

.header-main{
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  flex: 1 1 auto;
}

.nav-links{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Mobile behaviour for header */
@media (max-width: 640px){
  .header-container{
    top: 8px;
    gap: 12px;
  }
  .header-main{ width: 100%; justify-content: space-between; }
  .header-main .btn,
  .header-container .btn-logout{ width: 100%; }
}

/* =========================
   Cards / Sections
========================= */
.page-section{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 16px;
}

.section-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

main{ width: 100%; }

@media (max-width: 640px){
  .section-top{
    flex-direction: column;
    align-items: flex-start;
  }
}

/* =========================
   Forms / Inputs (Eye-friendly)
========================= */
input,
textarea,
select{
  font-family: var(--font) !important;
  background: var(--input-bg);
  color: var(--input-text);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: var(--fs-14);
  outline: none;
  -webkit-text-fill-color: var(--input-text); /* critical visibility fix */
}

input::placeholder,
textarea::placeholder{
  color: var(--input-placeholder);
}

input:focus,
textarea:focus,
select:focus{
  border-color: rgba(56,189,248,.55);
  box-shadow: 0 0 0 2px var(--focus);
}

/* =========================
   Buttons (Unified)
   Backward-compatible: .btn, .btn-ghost, .btn-primary, .btn-logout
========================= */
.btn,
.btn-theme{
  font-family: var(--font);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  cursor: pointer;
  border: 1px solid transparent;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease, filter .12s ease;
}

.btn:active,
.btn-theme:active{
  transform: translateY(1px);
}

.btn{
  background: var(--secondary);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(0,0,0,.22);
}
.btn:hover{ filter: brightness(0.96); box-shadow: 0 6px 16px rgba(0,0,0,.26); }

.btn-primary{
  background: var(--primary);
  color: #ffffff;
  border: none;
}
.btn-primary:hover{ filter: brightness(0.96); }

.btn-ghost,
.btn-theme.ghost{
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}
.btn-ghost:hover,
.btn-theme.ghost:hover{
  background: var(--surface-3);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.btn-ghost.active{
  background: var(--primary-soft);
  color: var(--text-strong);
  border-color: rgba(34,197,94,.35);
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}

.btn-ghost.disabled{
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Logout / danger */
.btn-logout,
.btn-theme.secondary{
  background: var(--bad);
  color: #fff;
  border: none;
}
.btn-logout:hover,
.btn-theme.secondary:hover{
  filter: brightness(0.95);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.28);
}

/* Button sizes */
.btn-sm,
.btn-chart{
  padding: 6px 10px;
  border-radius: var(--r-sm);
  font-size: var(--fs-13);
}

/* =========================
   Pills / Badges
========================= */
.pill{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--fs-12);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.pill.sel{
  background: var(--primary-soft);
  border-color: rgba(34,197,94,.35);
  color: var(--text-strong);
}

.badge{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--fs-12);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.badge.ok{ border-color: rgba(22,163,74,.35); background: rgba(22,163,74,.14); }
.badge.warn{ border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.14); }
.badge.bad{ border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.14); }

/* =========================
   Strategy Controls / Filters (Back-Compat)
========================= */
.strategy-controls{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.strategy-controls form{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  justify-content: center;
}

.control-field{
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
  background: var(--surface);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  padding: 8px 12px;
}

.control-field label{
  font-size: var(--fs-13);
  color: var(--muted);
}

.toggle-field{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--fs-13);
  color: var(--text);
}

.toggle-field input{ width: auto; }

@media (max-width: 768px){
  .strategy-controls,
  .strategy-controls form{
    flex-direction: column;
    align-items: stretch;
  }
  .strategy-controls button,
  .strategy-controls select{ width: 100%; }
}

/* Category filters and list */
.cat-bar{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin: 10px 0 16px;
}
.cat-btn{
  padding:8px 12px;
  border:1px solid var(--border);
  border-radius:999px;
  background: var(--surface);
  cursor:pointer;
  font-family:inherit;
  color: var(--text);
}
.cat-btn.active{
  background: var(--primary-soft);
  color: var(--text-strong);
  border-color: rgba(34,197,94,.35);
}

.strategy-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap:12px;
}
.strategy-card{
  border:1px solid var(--border);
  border-radius: var(--r-md);
  padding:12px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  display:flex;
  flex-direction:column;
  gap:8px;
}
.strategy-card .title{ font-weight: 700; color: var(--text-strong); }
.strategy-card .meta{ color: var(--muted); font-size: var(--fs-12); }
.strategy-card form{ margin:0; }

/* =========================
   Viewpoint Box (Back-Compat)
========================= */
.viewpoint-box{
  padding: 10px 15px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: var(--fs-15, 15px);
  font-weight: 700;
}

.viewpoint-box .label{
  white-space: nowrap;
  color: var(--text-strong);
}
#viewpoint{
  font-weight: 500;
  color: var(--text);
}

/* =========================
   Loader / Error
========================= */
.loader{
  display: none;
  text-align: center;
  padding: 20px;
  font-size: var(--fs-16);
  color: var(--muted);
}
.loader.active{ display: block; }

.error-message{
  display: none;
  text-align: center;
  color: #fff;
  padding: 12px 14px;
  background: rgba(239,68,68,.16);
  border: 1px solid rgba(239,68,68,.35);
  border-radius: var(--r-md);
  margin-bottom: 12px;
}
.error-message.active{ display: block; }

/* =========================
   Tables (Unified)
   - Keep existing .table-container behavior
========================= */
.table-container{
  width: 100%;
  overflow-x: auto;
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 12px;
}

.table-container::-webkit-scrollbar{ height: 8px; }
.table-container::-webkit-scrollbar-thumb{
  background-color: rgba(56,189,248,.25);
  border-radius: 999px;
}

table{
  width: 100%;
  border-collapse: collapse;
  background: transparent;
}

.table-container table{
  min-width: 700px;
}

th, td{
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  text-align: center;
  color: var(--text);
}

th{
  background: var(--table-head);
  color: var(--text-strong);
  font-weight: 700;
}

tbody tr:hover{ background: var(--row-hover); }

@media (max-width: 640px){
  th, td{ padding: 10px 6px; font-size: var(--fs-13); }
  .table-container table{ min-width: 540px; }
}

/* Back-compat: spaced */
.spaced{ margin-right: 1em; }

/* If error shown, disable table interaction */
.error-message.active + .table-container{
  opacity: 0.55;
  pointer-events: none;
}

/* =========================
   Auth shared styles
========================= */
.auth-wrap{
  display:flex;
  justify-content:center;
  align-items:center;
  min-height:60vh;
}

.auth-card{
  width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-card h1{
  margin:0 0 12px;
  font-size: 22px;
  text-align:center;
}
.auth-card p.sub{
  margin:0 0 20px;
  text-align:center;
  color: var(--muted);
  font-size: var(--fs-14);
}
.account-wrap{
  align-items:flex-start;
  padding: 24px 16px;
}
.account-grid{
  width: min(960px, 100%);
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.account-grid .auth-card{
  width: auto;
}
.account-header{
  grid-column: 1 / -1;
  text-align:center;
}
.account-header h1{
  margin: 0 0 8px;
  font-size: 24px;
}
.account-header p.sub{
  margin: 0 0 12px;
  color: var(--muted);
  font-size: var(--fs-14);
}
.account-info{
  color:#065f46;
  background:#d1fae5;
  border:1px solid #a7f3d0;
  padding:8px 10px;
  border-radius:8px;
  margin-bottom:10px;
  font-size:13px;
}
.account-card h2{
  margin: 0 0 14px;
  font-size: 18px;
  text-align:center;
}
.account-meta{
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.meta-row{
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--fs-13);
}
.meta-row .label{
  color: var(--muted);
}
.meta-row .value{
  color: var(--text);
  font-weight: 600;
}
.form-row{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin-bottom:14px;
}
.form-row label{
  font-size: var(--fs-13);
  color: var(--muted);
}
.actions{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top:8px;
}
.error{
  color: #fff;
  background: rgba(239,68,68,.16);
  border: 1px solid rgba(239,68,68,.35);
  padding: 8px 10px;
  border-radius: var(--r-sm);
  margin-bottom: 10px;
  font-size: var(--fs-13);
  text-align:center;
}

/* =========================
   Chart Viewer (Back-Compat, Dark-friendly)
========================= */
.chart-viewer{
  position: fixed;
  inset: auto 16px 16px 16px;
  max-width: min(1200px, 96vw);
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 12px;
  z-index: 1200;
  display: none;
  border: 1px solid var(--border);
}
.chart-viewer.active{ display: block; }

.chart-viewer.fullscreen{
  inset: 0;
  margin: 0;
  max-width: none;
  border-radius: 0;
  height: 95vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.chart-viewer__header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.chart-viewer__title{
  font-weight: 800;
  font-size: var(--fs-16);
  color: var(--text-strong);
}

.chart-viewer__actions{ display:flex; gap:8px; align-items:center; }

.chart-viewer__body{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
}

.chart-viewer__image{
  flex: 3;
  min-width: 320px;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
}
.chart-viewer__image img{
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: var(--r-sm);
}

.chart-viewer__stats{
  flex: 1.1;
  min-width: 180px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px;
  font-size: var(--fs-14);
  color: var(--text);
  display: none;
}
.chart-viewer__status{
  margin-top: 6px;
  font-size: var(--fs-13);
  color: var(--bad);
}
.chart-viewer.fullscreen .chart-viewer__body{
  flex: 1;
  height: 100%;
}

.chart-viewer__fullscreen,
.chart-viewer__close{
  min-width: 80px;
}

@media (max-width: 720px){
  .chart-viewer{ inset: auto 10px 10px 10px; }
  .chart-viewer__body{ flex-direction: column; }
  .chart-viewer__image img{ max-height: 60vh; }
}

/* =========================
   Strategy Chart Page
========================= */
.strategy-chart{
  max-width: 1100px;
  margin: 20px auto;
}

.strategy-chart__title{
  margin-bottom: 10px;
}

.strategy-chart__card{
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.strategy-chart__image{
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.strategy-chart__stats{
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.strategy-chart__panel{
  flex: 1;
  min-width: 200px;
  background: #fff;
  border-radius: 12px;
  padding: 12px;
}

.strategy-chart__panel-title{
  margin-top: 0;
}

.strategy-chart__panel-list{
  padding-right: 20px;
  margin: 0;
}

/* =========================
   Option Chain: Symbols strip (Back-Compat)
========================= */
.symbols-buttons{
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.symbols-buttons .symbol-form{ margin: 0; }

.symbols-buttons .btn{
  width: auto;
  font-size: 0.85rem;
  line-height: 1.6;
  padding-block: 0.25rem;
  padding-inline: 0.9rem;
  white-space: nowrap;
}

.symbols-strip .strip-header{
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.symbols-buttons .symbol-name{
  font-weight: 700;
  margin-left: 0.35rem;
}

.symbols-buttons .symbol-oi{
  font-size: 0.75em;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border: 1px solid lightgray;
}

/* Sort form */
.sort-form{
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
}
.sort-form .btn.btn-xs{
  font-size: 0.75rem;
  padding: 0.15rem 0.4rem;
}

/* Head extra card (Back-Compat) */
.head-extra-card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 4px 12px 12px;
  margin: 0 0 12px;
  box-shadow: var(--shadow-soft);
}

.head-extra-card summary{
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
}
.head-extra-card summary::-webkit-details-marker{ display: none; }

.head-extra-card__title{
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: var(--text-strong);
}
.head-extra-card__hint{
  color: var(--muted);
  font-size: var(--fs-13);
}

.head-extra-card .badge{
  background: rgba(56,189,248,.18);
  color: var(--text-strong);
  border-radius: var(--r-sm);
  padding: 4px 10px;
  font-size: var(--fs-12);
  border: 1px solid rgba(56,189,248,.30);
  box-shadow: none;
}

.head-extra-card__content{
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 4px 6px;
}

.pill-list{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill-list .pill{
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: var(--fs-13);
}

.symbol-pill{
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(56,189,248,.20), 0 4px 10px rgba(0,0,0,.20);
  transition: transform 0.08s ease, box-shadow 0.08s ease, border-color .12s ease;
  font-family: inherit;
  color: var(--text);
}

.symbol-pill.sel{
  background: var(--primary-soft);
  color: var(--text-strong);
  border-color: rgba(34,197,94,.35);
  box-shadow: inset 0 2px 3px rgba(34,197,94,.18), 0 2px 0 rgba(34,197,94,.22), 0 4px 10px rgba(0,0,0,.22);
}

.symbol-pill:active{
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(56,189,248,.16), 0 2px 6px rgba(0,0,0,.18);
}

.symbols-filter__actions{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
}

.symbols-filter__count{
  font-size: var(--fs-12);
  color: var(--muted);
}

/* =========================
   Compatibility: h1 center rule from old CSS
========================= */
h1{ text-align: center; }

/* additional */
/* Ensure buttons inherit Vazir (some browsers don't inherit font for buttons) */
button { font-family: var(--font); }

/* Auth page button sizing */
.btn-auth{
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  font-size: var(--fs-15, 15px);
}

/* OTP input: readable numeric code */
.otp-input{
  letter-spacing: 2px;
  text-align: center;
}

/* Optional: green info box as a proper component */
.notice{
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  text-align: center;
}
.notice-ok{
  background: rgba(22,163,74,.14);
  border-color: rgba(22,163,74,.30);
  color: var(--text);
}

/* Strategy Hero (moved from base.html inline styles) */
.strategy-hero{
  margin: 15px auto 20px;
  padding: 16px 24px;
  max-width: 1200px;
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.strategy-hero__top{
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.strategy-hero__title{
  margin: 12px 0 8px;
  text-align: center;
  font-size: 28px;
  font-weight: 800;
}

.strategy-hero__summary{
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  font-size: 14px;
}
.strategy-hero__summary span{ color: var(--text); }
.strategy-hero__summary b{ font-size: 16px; margin: 0 3px; }

.strategy-hero__controls{
  margin-top: 12px;
  display: flex;
  justify-content: center;
}
.strategy-hero__controls form,
.strategy-hero__controls .strategy-controls{
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.viewpoint-pill{
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 14px;
  color: var(--text);
}
.viewpoint-pill .label{ margin-left: 6px; font-weight: 700; }

@media (max-width: 900px){
  .strategy-hero{ margin: 10px auto 16px; padding: 14px 18px; }
  .strategy-hero__top{ flex-direction: column; align-items: stretch; gap: 12px; }
  .strategy-hero__summary{ justify-content: flex-start; }
  .strategy-hero__controls form,
  .strategy-hero__controls .strategy-controls{
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .strategy-hero__controls button,
  .strategy-controls button{ width: 100%; }
}
@media (max-width: 600px){
  .strategy-hero__title{ font-size: 22px; line-height: 1.4; }
  .strategy-hero__summary{ font-size: 13px; gap: 10px; }
  .strategy-hero__summary span{ width: 100%; }
}

/* =========================
   Auth Header (Branding)
========================= */
.auth-header{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
}

.auth-header__logo{
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.auth-header__logo img{
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.auth-header__title{
  font-size: 16px;
  font-weight: 800;
  color: var(--text-strong);
  letter-spacing: -0.2px;
}

/* Slight divider under brand */
.auth-header + h1{
  margin-top: 6px;
}

/* =========================
   Auth Tabs (Pills)
========================= */
.auth-tabs{
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 10px 0 14px;
}

.auth-tab{
  text-decoration: none;
  font-weight: 800;
}

.auth-panels{
  margin-top: 8px;
}

.auth-panel.is-hidden{
  display: none;
}

.auth-tabs{
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 10px 0 14px;
}

.auth-tab{
  text-decoration: none;
  font-weight: 800;
}

.auth-panel.is-hidden{ display: none; }

.flash-stack { display:flex; flex-direction:column; gap:10px; }
.flash {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.92);
  font-size: 14px;
  line-height: 1.8;
}
.flash-success { border-color: rgba(80,200,120,0.35); background: rgba(80,200,120,0.10); }
.flash-error   { border-color: rgba(255,90,90,0.40);  background: rgba(255,90,90,0.10); }
.flash-warning { border-color: rgba(255,200,80,0.40); background: rgba(255,200,80,0.10); }
.flash-info    { border-color: rgba(120,160,255,0.35); background: rgba(120,160,255,0.10); }

/* -------------------------
   Mobile Nav (Drawer)
------------------------- */

.nav-toggle{
  display:none;
  align-items:center;
  justify-content:center;
  width:42px;
  height:42px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: inherit;
  cursor:pointer;
}

.nav-toggle:active{ transform: translateY(1px); }

.nav-toggle__icon{
  width:18px; height:12px;
  display:block;
  position:relative;
}

.nav-toggle__icon::before,
.nav-toggle__icon::after,
.nav-toggle__icon{
  background: transparent;
}

.nav-toggle__icon::before,
.nav-toggle__icon::after{
  content:"";
  position:absolute;
  left:0; right:0;
  height:2px;
  background: rgba(255,255,255,.85);
  border-radius:2px;
}

.nav-toggle__icon::before{ top:0; }
.nav-toggle__icon::after{ bottom:0; }

/* middle line */
.nav-toggle__icon{
  box-shadow: 0 5px 0 0 rgba(255,255,255,.85);
}

/* Drawer base */
.mobile-nav{
  position:fixed;
  inset:0;
  z-index:9999;
  display:none;
}

.mobile-nav__overlay{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.55);
  opacity:0;
  transition: opacity .18s ease;
}

.mobile-nav__panel{
  position:absolute;
  top:0;
  right:0; /* RTL: پنل از راست */
  height:100%;
  width:min(88vw, 360px);
  background: rgba(12,18,32,.98);
  border-left:1px solid rgba(255,255,255,.10);
  box-shadow: -18px 0 40px rgba(0,0,0,.45);
  transform: translateX(100%);
  transition: transform .18s ease;
  display:flex;
  flex-direction:column;
  padding:14px;
  gap:12px;
}

.mobile-nav.is-open{ display:block; }
.mobile-nav.is-open .mobile-nav__overlay{ opacity:1; }
.mobile-nav.is-open .mobile-nav__panel{ transform: translateX(0); }

/* Top row */
.mobile-nav__top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.mobile-nav__brand{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:700;
}

.mobile-nav__close{
  width:42px;
  height:42px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.92);
  cursor:pointer;
  font-size:22px;
  line-height:1;
}

.mobile-nav__viewpoint{
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  font-size:13px;
}

.mobile-nav__links{
  display:flex;
  flex-direction:column;
  gap:8px;
  overflow:auto;
  padding:4px 2px;
  flex:1;
}

.mobile-link{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  text-decoration:none;
  color: inherit;
}

.mobile-link.is-active{
  border-color: rgba(255,255,255,.24);
  background: rgba(255,255,255,.07);
}

.mobile-nav__actions{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}

/* Lock scroll when drawer open */
.no-scroll{
  overflow:hidden !important;
}

/* -------------------------
   Responsive behavior
------------------------- */
@media (max-width: 860px){
  .nav-toggle{ display:inline-flex; }

  /* دسکتاپ: لینک‌های ردیفی را در موبایل مخفی کن */
  .nav-desktop{ display:none !important; }

  /* هدر: چیدمان بهتر برای موبایل */
  .topbar .header-container{
    gap:10px;
  }

  /* دکمه‌های سمت راست/چپ (تماس/خروج) کوچک‌تر و قابل‌چیدمان */
  .topbar .header-container > a.btn{
    padding:10px 10px;
    white-space:nowrap;
  }
}

  .controls-panel{
    border:1px solid rgba(255,255,255,.10);
    background: rgba(255,255,255,.03);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 10px;
  }

  .controls-panel__summary{
    list-style:none;
    cursor:pointer;
    display:flex;
    align-items:center;
    gap:12px;
    padding: 10px 12px;
    user-select:none;
  }
  .controls-panel__summary::-webkit-details-marker{ display:none; }

  .controls-panel__summary-left{
    display:flex;
    align-items:baseline;
    gap:10px;
    flex:1;
    min-width: 0;
  }
  .controls-panel__title{ font-weight: 700; white-space:nowrap; }
  .controls-panel__hint{
    white-space:nowrap;
    overflow:hidden;
    text-overflow: ellipsis;
    opacity:.85;
  }

  .controls-panel__summary-actions{
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap: wrap;
  }

  .controls-panel__chev{
    opacity:.8;
    transition: transform .15s ease;
  }
  details[open] .controls-panel__chev{ transform: rotate(180deg); }

  .controls-panel__body{ padding: 10px 12px 12px; }

  .strategy-controls--stack{ display:flex; flex-direction:column; gap:10px; }
  .controls-card{
    border:1px solid rgba(255,255,255,.10);
    background: rgba(0,0,0,.12);
    border-radius: 12px;
    padding: 10px;
  }

  .controls-grid{
    display:grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 10px;
    align-items:end;
  }
  .controls-grid--dense{
    grid-template-columns: repeat(5, minmax(160px, 1fr));
  }
  .controls-actions{
    display:flex;
    gap:10px;
    justify-content:flex-end;
    align-items:center;
  }

  .toggle-field--compact span{ opacity:.9; }
  .toggle-field--compact{ padding: 0 6px; }

  @media (max-width: 920px){
    .controls-grid--dense{ grid-template-columns: repeat(2, minmax(160px, 1fr)); }
  }
  @media (max-width: 720px){
    .controls-panel__summary{
      flex-direction: column;
      align-items: stretch;
    }
    .controls-panel__summary-actions{
      justify-content: flex-start;
    }
    .controls-grid,
    .controls-grid--dense{
      grid-template-columns: 1fr;
    }
    .controls-actions{
      justify-content:flex-start;
      flex-wrap: wrap;
    }
  }

  
