/* «کپی» and «سبد کپی من» (copybasket.js), phase 1: the popup (a bottom
   sheet on phones, a centred dialog on desktop), the basket's sheet and its
   floating button. Built on copytrade.html's tokens (--g-*), light and dark,
   right to left; every class starts with cb- and nothing here applies
   without copybasket.js's own nodes. */
:root, :root[data-theme="light"] {
  --cb-red:var(--g-down); --cb-red-soft:var(--g-down-soft); --cb-red-line:#F3B7B7; --cb-red-ink:#B91C1C;
  --cb-amber:var(--g-amber-ink); --cb-amber-soft:var(--g-amber-soft); --cb-amber-line:var(--g-amber-line);
  --cb-up-ink:#15803D;
}
:root[data-theme="dark"] {
  --cb-red:var(--g-down); --cb-red-soft:var(--g-down-soft); --cb-red-line:rgba(248,113,113,.42); --cb-red-ink:var(--g-down);
  --cb-amber:var(--g-amber-ink); --cb-amber-soft:var(--g-amber-soft); --cb-amber-line:var(--g-amber-line);
  --cb-up-ink:var(--g-up);
}

body.cb-locked { overflow:hidden; }
/* The page's toast says «به سبد کپی اضافه شد» over an open basket too. */
body.cb-locked .ct-toast { z-index:96; }

/* ---- the frame ---- */
.cb-scrim {
  position:fixed; inset:0; z-index:95; display:grid; place-items:center; padding:24px 16px;
  background:var(--g-scrim); overscroll-behavior:contain;
}
.cb-scrim[hidden] { display:none; }
.cb-dialog {
  position:relative; width:min(560px, calc(100vw - 32px)); max-height:calc(100vh - 48px); max-height:calc(100dvh - 48px);
  display:flex; flex-direction:column; min-height:0; overflow:hidden;
  background:var(--g-card); color:var(--g-ink); border:1px solid var(--g-line); border-radius:18px; box-shadow:var(--g-pop);
  font-family:'Vazirmatn','IRANSans',Tahoma,sans-serif; direction:rtl; text-align:start;
}
.cb-dialog.cb-wide { width:min(640px, calc(100vw - 32px)); }
/* The dialog takes the focus itself only when a redraw removed the focused control (no ring for that). */
.cb-dialog:focus { outline:none; }
.cb-dialog :where(h2, h3, p, ol, ul, dl, dd) { margin:0; }
.cb-dialog :where(button, input, a) { font-family:inherit; }
.cb-dialog bdi { unicode-bidi:isolate; }

.cb-head { flex:none; padding:14px 18px 12px; border-bottom:1px solid var(--g-line-soft); }
.cb-grab { display:none; width:40px; height:4px; margin:0 auto 10px; border-radius:99px; background:var(--g-line); }
.cb-head-row { display:flex; align-items:flex-start; gap:12px; min-width:0; }
.cb-head-row > .ct-avatar { width:46px; height:46px; font-size:18px; }
.cb-avatar-blank { background:var(--g-skeleton); }
.cb-head-mark {
  flex:none; width:44px; height:44px; border-radius:14px; display:grid; place-items:center;
  color:var(--g-teal-ink); background:var(--g-teal-soft); border:1px solid var(--g-teal-line);
}
.cb-head-id { flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.cb-title { font-size:17px; font-weight:800; line-height:1.6; overflow-wrap:anywhere; }
.cb-head-line > span { white-space:nowrap; }
.cb-head-line { display:flex; flex-wrap:wrap; align-items:center; gap:2px 6px; font-size:12.5px; font-weight:700; color:var(--g-ink-2); line-height:1.8; }
.cb-head-note { font-size:11.5px; font-weight:600; color:var(--g-ink-3); line-height:1.8; }
.cb-sep { color:var(--g-ink-3); }
.cb-amber-text { color:var(--cb-amber); }
.cb-in {
  align-self:flex-start; display:inline-flex; align-items:center; gap:4px; margin-top:4px; padding:2px 9px; border-radius:99px;
  font-size:11.5px; font-weight:800; line-height:1.7; background:var(--g-teal-soft); color:var(--g-teal-ink);
}
.cb-x {
  flex:none; width:36px; height:36px; margin:-4px -6px 0 0; border:0; border-radius:50%; display:grid; place-items:center;
  background:none; color:var(--g-ink-3); cursor:pointer;
}
.cb-x:hover { background:var(--g-flat-soft); color:var(--g-ink); }

.cb-body {
  flex:1 1 auto; min-height:0; overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch;
  padding:14px 18px 16px; display:flex; flex-direction:column; gap:14px;
}
.cb-foot {
  flex:none; padding:12px 18px; border-top:1px solid var(--g-line-soft); background:var(--g-card);
  display:flex; flex-direction:column; gap:6px;
}
.cb-alert { flex:none; padding:0 18px; }
.cb-alert[hidden] { display:none; }
.cb-alert p {
  margin:8px 0 0; padding:9px 12px; border-radius:10px; font-size:13px; font-weight:700; line-height:1.8;
  background:var(--cb-red-soft); color:var(--cb-red-ink); border:1px solid var(--cb-red-line);
}

/* ---- sections ---- */
.cb-sec { display:flex; flex-direction:column; gap:8px; min-width:0; }
.cb-sec[hidden] { display:none; }
.cb-sec h3, .cb-mt5 h3 { font-size:14px; font-weight:800; line-height:1.6; color:var(--g-ink); }
.cb-sub { font-size:12px; font-weight:700; color:var(--g-ink-3); line-height:1.8; }
.cb-note { font-size:11.5px; font-weight:600; color:var(--g-ink-3); line-height:1.8; }
.cb-help { font-size:12px; font-weight:600; color:var(--g-ink-3); line-height:1.9; }
.cb-line { font-size:13px; line-height:1.95; color:var(--g-ink-2); }
.cb-line b { color:var(--g-ink); font-weight:800; }
.cb-strip {
  padding:9px 12px; border-radius:10px; font-size:12.5px; font-weight:700; line-height:1.8;
  background:var(--g-teal-soft); color:var(--g-teal-ink); border:1px solid var(--g-teal-line);
}
/* Phase 1: «کپی هنوز فعال نیست» (the popup, above the tick) and «هنوز هیچ سفارشی اجرا نمی‌شود» (the basket). */
.cb-phase {
  display:flex; align-items:flex-start; gap:8px; padding:10px 12px; border-radius:12px;
  font-size:12.5px; font-weight:600; line-height:1.9; color:var(--g-ink-2);
  background:var(--g-flat-soft); border:1px solid var(--g-line);
}
.cb-phase > .ico { flex:none; margin-top:4px; color:var(--g-teal-ink); }
.cb-phase b { color:var(--g-ink); font-weight:800; }

.cb-tiles { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:8px; }
.cb-tile { min-width:0; padding:9px 11px; border-radius:12px; background:var(--g-flat-soft); display:flex; flex-direction:column; gap:1px; }
.cb-tile dt { font-size:11.5px; font-weight:700; color:var(--g-ink-3); line-height:1.7; }
.cb-tile-v { font-size:16px; font-weight:800; line-height:1.6; color:var(--g-ink); }
.cb-tile-s { font-size:11px; font-weight:600; color:var(--g-ink-3); line-height:1.6; }
.cb-tile-stop { grid-column:span 2; }
.cb-tile .up { color:var(--g-up); }
.cb-tile .down { color:var(--g-down); }
.cb-skel { display:inline-block; height:.9em; min-width:28px; border-radius:6px; background:var(--g-skeleton); vertical-align:middle; }
.cb-fail { display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; padding:10px 12px; border-radius:12px; background:var(--g-flat-soft); }
.cb-fail p { font-size:13px; font-weight:700; color:var(--g-ink-2); line-height:1.8; }

/* ---- the account and the risk ---- */
.cb-field { font-size:12.5px; font-weight:700; color:var(--g-ink-2); }
.cb-input {
  width:100%; height:44px; padding:0 12px; border:1px solid var(--g-line); border-radius:11px;
  background:var(--g-card); color:var(--g-ink); font-size:16px; font-weight:700; text-align:end;
}
.cb-input::placeholder { color:var(--g-ink-3); font-weight:600; }
.cb-input:focus { outline:none; border-color:var(--g-teal); box-shadow:0 0 0 3px var(--g-teal-soft); }
.cb-input[aria-invalid="true"] { border-color:var(--cb-red); }
.cb-err { font-size:12px; font-weight:700; color:var(--cb-red-ink); line-height:1.7; }
.cb-err:empty { display:none; }
.cb-seg {
  display:flex; padding:3px; gap:2px; border-radius:11px; background:var(--g-flat-soft); border:1px solid var(--g-line-soft);
}
.cb-seg-btn {
  flex:1 1 0; min-width:0; height:36px; padding:0 8px; border:0; border-radius:9px; background:none; color:var(--g-ink-2);
  font-size:13px; font-weight:700; cursor:pointer; white-space:nowrap;
}
.cb-seg-btn:hover { color:var(--g-ink); }
.cb-seg-btn[aria-pressed="true"] { background:var(--g-card); color:var(--g-teal-ink); font-weight:800; box-shadow:0 1px 2px rgba(15,27,45,.08); }
:root[data-theme="dark"] .cb-seg-btn[aria-pressed="true"] { background:var(--g-teal-soft); box-shadow:none; }
.cb-chips { display:flex; flex-wrap:wrap; gap:8px; }
.cb-chip {
  min-width:64px; height:38px; padding:0 14px; border-radius:99px; border:1px solid var(--g-line); background:var(--g-card);
  color:var(--g-ink-2); font-size:14px; font-weight:800; cursor:pointer;
}
.cb-chip:hover { border-color:var(--g-teal-line); color:var(--g-ink); }
.cb-chip[aria-pressed="true"] { background:var(--g-teal-soft); border-color:var(--g-teal); color:var(--g-teal-ink); }

/* ---- the preview ---- */
.cb-prev { padding:12px 14px; border-radius:14px; border:1px solid var(--g-line); }
.cb-pvs { display:flex; flex-direction:column; }
.cb-pv {
  /* The label and its value on one line while both fit; a long value goes under its label, at the end. */
  display:flex; flex-wrap:wrap; align-items:baseline; gap:0 12px;
  padding:7px 0; border-top:1px solid var(--g-line-soft);
}
.cb-pv:first-child { border-top:0; padding-top:2px; }
.cb-pv dt { flex:1 1 150px; font-size:12.5px; font-weight:700; color:var(--g-ink-2); line-height:1.8; min-width:0; }
.cb-pv dd { flex:0 1 auto; margin-inline-start:auto; font-size:13.5px; font-weight:800; color:var(--g-ink); line-height:1.8; text-align:end; min-width:0; overflow-wrap:anywhere; }
.cb-pv .cb-pv-note { flex:1 1 100%; margin-inline-start:0; font-size:11.5px; font-weight:600; color:var(--g-ink-3); text-align:start; }
.cb-pv.bad dd:not(.cb-pv-note) { color:var(--cb-red); }
.cb-pv.good dd:not(.cb-pv-note) { color:var(--cb-up-ink); }
.cb-pv.warn dd:not(.cb-pv-note) { color:var(--cb-amber); }
.cb-pv[data-pv="min"] dd, .cb-pv[data-pv="basket"] dd:not(.cb-pv-note) { font-weight:700; }
.cb-pv[data-pv="basket"] dd:not(.cb-pv-note) { flex-basis:100%; text-align:start; }

/* ---- warnings: a box per tone ---- */
.cb-warns { display:flex; flex-direction:column; gap:8px; }
.cb-warns:empty { display:none; }
.cb-warn { padding:10px 12px; border-radius:12px; border:1px solid; display:flex; flex-direction:column; gap:8px; font-size:12.5px; line-height:1.9; }
.cb-warn.red { background:var(--cb-red-soft); border-color:var(--cb-red-line); color:var(--g-ink); }
.cb-warn.red .cb-w > p:first-child { color:var(--cb-red-ink); font-weight:800; }
.cb-warn.amber { background:var(--cb-amber-soft); border-color:var(--cb-amber-line); color:var(--g-ink); }
.cb-warn.amber .cb-w > p { font-weight:700; }
.cb-warn.grey { background:var(--g-flat-soft); border-color:var(--g-line-soft); color:var(--g-ink-2); }
.cb-w { display:flex; flex-direction:column; gap:4px; }
.cb-alts-h { font-weight:800; color:var(--g-ink); }
.cb-alts { padding:0; list-style:none; display:flex; flex-direction:column; gap:6px; }
.cb-alts li { display:flex; flex-wrap:wrap; align-items:center; gap:6px 10px; padding-inline-start:12px; position:relative; color:var(--g-ink-2); }
.cb-alts li::before { content:''; position:absolute; inset-inline-start:0; top:.85em; width:5px; height:5px; border-radius:50%; background:var(--g-ink-3); }
.cb-alts li[data-alt="demo"]::before { display:none; }
.cb-alts li[data-alt="demo"] { padding-inline-start:0; }
.cb-soon {
  height:32px; padding:0 12px; border-radius:99px; border:1px dashed var(--g-line); background:var(--g-card);
  color:var(--g-ink-3); font-size:12px; font-weight:700; cursor:not-allowed;
}

/* ---- the rules and the tick ---- */
.cb-rules { padding:12px 14px; border-radius:14px; background:var(--g-flat-soft); }
.cb-rules ol { padding-inline-start:20px; list-style-type:persian; display:flex; flex-direction:column; gap:4px; }
.cb-rules li { font-size:12.5px; line-height:1.9; color:var(--g-ink-2); }
.cb-rules li::marker { color:var(--g-ink-3); font-weight:800; }
.cb-tick { display:flex; align-items:flex-start; gap:10px; padding:10px 12px; border-radius:12px; border:1px solid var(--g-line); cursor:pointer; }
.cb-tick input { flex:none; width:20px; height:20px; margin:3px 0 0; accent-color:var(--g-teal); cursor:pointer; }
.cb-tick span { font-size:12.5px; font-weight:700; line-height:1.9; color:var(--g-ink); }
.cb-tick:has(input:checked) { border-color:var(--g-teal-line); background:var(--g-teal-soft); }

/* ---- buttons ---- */
.cb-foot-btns { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.cb-btn {
  display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:44px; padding:0 16px; border-radius:11px;
  border:1px solid transparent; font-size:14px; font-weight:800; line-height:1.3; text-align:center; text-decoration:none; cursor:pointer;
  transition:filter .15s, border-color .15s, background .15s;
}
.cb-btn.small { min-height:36px; padding:0 12px; font-size:13px; border-radius:10px; }
.cb-btn.primary { flex:1 1 200px; background:var(--g-up); color:#fff; }
.cb-btn.primary:hover { filter:brightness(.93); }
:root[data-theme="dark"] .cb-btn.primary { color:#0B1314; }
.cb-btn.primary:disabled { background:var(--g-flat-soft); color:var(--g-ink-3); border-color:var(--g-line); cursor:not-allowed; filter:none; }
/* Red and disabled: the account is too small for this source (the owner: «دکمه شروع قرمز و غیرفعال»). */
.cb-btn.primary.red:disabled { background:var(--cb-red-soft); color:var(--cb-red-ink); border-color:var(--cb-red-line); }
.cb-btn.ghost { background:var(--g-card); color:var(--g-ink); border-color:var(--g-line); }
.cb-btn.ghost:hover { border-color:var(--g-teal-line); }
.cb-btn.ghost:disabled { color:var(--g-ink-3); cursor:not-allowed; }
.cb-btn.danger { background:var(--g-down); color:#fff; }
:root[data-theme="dark"] .cb-btn.danger { color:#0B1314; }
.cb-btn.text { background:none; border-color:transparent; padding:0 8px; }
.cb-btn.text.danger, :root[data-theme="dark"] .cb-btn.text.danger { color:var(--cb-red-ink); }
.cb-btn.text.danger:hover { background:var(--cb-red-soft); }
.cb-btn:disabled { opacity:1; }
.cb-btn .ico { width:15px; height:15px; }
.cb-reason { font-size:12px; font-weight:700; color:var(--g-ink-3); line-height:1.7; }
.cb-reason:empty { display:none; }
.cb-reason.red { color:var(--cb-red-ink); }
.cb-foot > .cb-btn.small { align-self:flex-start; }
.cb-out { font-size:11.5px; }
.cb-confirm { display:flex; flex-direction:column; gap:8px; }
.cb-confirm > p { font-size:13px; font-weight:800; color:var(--g-ink); line-height:1.8; }
.cb-link {
  padding:0 4px; border:0; background:none; color:var(--g-teal-ink); font-size:13px; font-weight:800; cursor:pointer;
  text-decoration:underline; text-underline-offset:3px;
}

/* ---- the basket ---- */
.cb-bar {
  display:flex; flex-direction:column; gap:4px; padding:12px 14px; border-radius:14px;
  background:var(--g-teal-soft); border:1px solid var(--g-teal-line);
}
.cb-bar[hidden] { display:none; }
.cb-body > [data-cb="state"]:empty { display:none; }
.cb-bar-figs { display:flex; flex-direction:column; gap:4px; }
.cb-bar-figs > p { font-size:13px; font-weight:700; line-height:1.9; color:var(--g-ink); }
.cb-bar-figs > p.cb-help { font-size:11.5px; color:var(--g-ink-2); font-weight:600; }
.cb-bar-acct { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:4px 10px; }
.cb-bar-acct > span { font-size:14px; font-weight:800; }
.cb-acct-edit { display:flex; flex-direction:column; gap:8px; padding:10px 12px; border-radius:12px; background:var(--g-card); border:1px solid var(--g-line); }
.cb-items { list-style:none; padding:0; display:flex; flex-direction:column; gap:8px; }
.cb-item { display:flex; align-items:flex-start; gap:10px; padding:12px; border-radius:14px; border:1px solid var(--g-line); min-width:0; }
.cb-item > .ct-avatar { width:40px; height:40px; font-size:16px; }
.cb-item.gone { background:var(--g-flat-soft); border-style:dashed; }
.cb-item-main { flex:1; min-width:0; display:flex; flex-direction:column; gap:4px; }
.cb-item-top { display:flex; flex-wrap:wrap; align-items:center; gap:4px 8px; min-width:0; }
.cb-item-name {
  min-width:0; max-width:100%; padding:0; border:0; background:none; color:var(--g-ink); font-size:14.5px; font-weight:800; line-height:1.6;
  text-align:start; cursor:pointer; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; unicode-bidi:plaintext;
}
button.cb-item-name:hover { color:var(--g-teal-ink); text-decoration:underline; text-underline-offset:3px; }
.cb-item-name.plain { cursor:default; color:var(--g-ink-2); white-space:normal; }
.cb-wait { padding:1px 8px; border-radius:99px; background:var(--g-flat-soft); color:var(--g-ink-3); font-size:11px; font-weight:800; line-height:1.8; white-space:nowrap; }
.cb-item-facts { display:flex; flex-wrap:wrap; gap:0 6px; font-size:12.5px; font-weight:600; line-height:1.9; color:var(--g-ink-2); }
.cb-item-red { font-size:12px; font-weight:800; line-height:1.8; color:var(--cb-red-ink); }
.cb-item-amber, .cb-bar-figs > p.cb-bar-amber { font-size:12px; font-weight:700; line-height:1.8; color:var(--cb-amber); }
.cb-item-acts { display:flex; flex-wrap:wrap; gap:6px; margin-top:2px; }
.cb-empty { display:flex; flex-direction:column; align-items:flex-start; gap:10px; padding:14px; border-radius:14px; background:var(--g-flat-soft); }
.cb-empty p, .cb-empty-line { font-size:13px; font-weight:700; color:var(--g-ink-2); line-height:1.9; }
.cb-empty-line { padding:12px 14px; border-radius:14px; border:1px dashed var(--g-line); }
.cb-mt5 { display:flex; flex-direction:column; gap:8px; padding:14px; border-radius:14px; border:1px dashed var(--g-teal-line); }
.cb-mt5 h3 { display:flex; align-items:center; gap:8px; color:var(--g-teal-ink); }
.cb-mt5 ul { padding-inline-start:18px; display:flex; flex-direction:column; gap:3px; }
.cb-mt5 li { font-size:12.5px; line-height:1.9; color:var(--g-ink-2); }
.cb-mt5 .cb-btn { align-self:flex-start; }

/* ---- the floating button ---- */
.cb-fab {
  position:fixed; z-index:55; left:16px; bottom:calc(16px + env(safe-area-inset-bottom));
  display:inline-flex; align-items:center; gap:8px; height:46px; padding:0 18px; border:0; border-radius:99px;
  background:var(--g-teal); color:#fff; box-shadow:var(--g-pop);
  font-family:'Vazirmatn','IRANSans',Tahoma,sans-serif; font-size:14px; font-weight:800; cursor:pointer; direction:rtl;
}
.cb-fab[hidden] { display:none; }
.cb-fab:hover { filter:brightness(.94); }
.cb-fab:focus-visible { outline:2px solid var(--g-ink); outline-offset:3px; }
:root[data-theme="dark"] .cb-fab { color:#0B1314; }
.cb-fab.cb-pulse { animation:cb-pulse .7s ease-out 2; }
@keyframes cb-pulse { 0% { transform:scale(1); } 45% { transform:scale(1.08); } 100% { transform:scale(1); } }

@media (prefers-reduced-motion:reduce) {
  .cb-fab.cb-pulse { animation:none; }
  .cb-btn { transition:none; }
}

/* ---- phones: a bottom sheet ---- */
@media (max-width:760px) {
  .cb-scrim { place-items:end stretch; padding:24px 0 0; }
  .cb-scrim:has(.cb-wide) { padding-top:12px; }
  .cb-dialog, .cb-dialog.cb-wide {
    width:100%; max-height:calc(100vh - 24px); max-height:calc(100dvh - 24px);
    border-radius:18px 18px 0 0; border-bottom:0;
  }
  .cb-dialog.cb-wide { max-height:calc(100vh - 12px); max-height:calc(100dvh - 12px); }
  .cb-grab { display:block; }
  .cb-head { padding:10px 16px 10px; }
  .cb-body { padding:12px 16px 14px; }
  .cb-alert { padding:0 16px; }
  .cb-foot { padding:10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .cb-tiles { grid-template-columns:repeat(2, minmax(0, 1fr)); }
  .cb-foot .cb-btn.primary { flex:1 1 150px; }
  .cb-foot .cb-btn.ghost { flex:0 0 auto; }
  .cb-fab { height:44px; padding:0 16px; font-size:13.5px; }
}
@media (max-width:360px) {
  .cb-tile { padding:8px 9px; }
  .cb-tile-v { font-size:15px; }
}

/* ctnav release 1 (design §7.6): the platform asked first, standard only, «انتخاب‌های من»'s waitlist line. */
.cb-plat { margin:0; padding:0; border:0; display:flex; flex-direction:column; gap:6px; min-width:0; }
.cb-plat > legend { padding:0; margin-bottom:4px; }
.cb-radios { display:flex; flex-wrap:wrap; gap:6px; }
.cb-radio {
  display:inline-flex; align-items:center; gap:8px; min-height:44px; padding:0 12px; border-radius:11px; border:1px solid var(--g-line);
  background:var(--g-card); color:var(--g-ink); font-size:13.5px; font-weight:700; cursor:pointer;
}
.cb-radio.on { border-color:var(--g-teal); background:var(--g-teal-soft); color:var(--g-teal-ink); }
.cb-radio input { width:16px; height:16px; margin:0; accent-color:var(--g-teal); }
.cb-radio:focus-within { outline:2px solid var(--g-teal); outline-offset:2px; }
.cb-plat-line { display:flex; flex-wrap:wrap; align-items:center; gap:4px 8px; }
.cb-interest { display:flex; flex-direction:column; gap:4px; padding:10px 12px; border-radius:12px; background:var(--g-amber-soft); border:1px dashed var(--g-amber-line); }
.cb-interest h3 { margin:0; font-size:13px; font-weight:800; color:var(--g-ink-2); }
.cb-interest p { margin:0; font-size:13.5px; font-weight:700; line-height:1.9; color:var(--g-ink); }
