

/* =========================================================
   VELAEA Step 1: Public / Private Portfolio Visibility
   ใช้กับ Dashboard สมาชิก เพื่อเลือกโชว์พอร์ต MT5 เป็นส่วนตัว/สาธารณะ
========================================================= */
.mt5-visibility-pill{
  display:inline-flex;align-items:center;justify-content:center;
  min-height:24px;padding:0 9px;border-radius:999px;font-size:10px;font-weight:950;
  letter-spacing:.04em;border:1px solid rgba(255,255,255,.10);white-space:nowrap;
}
.mt5-visibility-pill.is-private{color:#c7d4e4;background:rgba(159,176,195,.10);border-color:rgba(159,176,195,.16)}
.mt5-visibility-pill.is-public{color:#b9ffd4;background:rgba(88,216,120,.13);border-color:rgba(88,216,120,.28)}
.mt5-visibility-actions{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  margin-top:10px;padding-top:9px;border-top:1px solid rgba(255,255,255,.07);
  color:#9fb0c3;font-size:11px;font-weight:900;
}
.mt5-visibility-toggle{
  border:1px solid rgba(242,199,106,.28);background:rgba(242,199,106,.08);color:#f2c76a;
  border-radius:999px;min-height:28px;padding:0 10px;font-size:10px;font-weight:950;cursor:pointer;
}
.mt5-visibility-toggle:hover{border-color:rgba(242,199,106,.58);box-shadow:0 0 0 3px rgba(242,199,106,.10)}
.mt5-visibility-toggle.is-public{border-color:rgba(88,216,120,.28);background:rgba(88,216,120,.10);color:#58d878}
.mt5-port-card{cursor:pointer;text-align:left}
html[data-theme="light"] .mt5-visibility-actions{border-top-color:#e5ebf3;color:#657386}
html[data-theme="light"] .mt5-visibility-pill.is-private{background:#f2f6fb;color:#657386;border-color:#dbe3ee}
html[data-theme="light"] .mt5-visibility-toggle{background:#fff;color:#9c6d13;border-color:rgba(200,149,46,.28)}

/* =========================================================
   Step 2.4: VELAEA precise performance summary cards
========================================================= */
.mt5-performance-summary{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.mt5-performance-summary .mt5-analytics-card{min-width:0;overflow:hidden}
.mt5-performance-summary .mt5-analytics-card strong{font-variant-numeric:tabular-nums;line-height:1.05;word-break:break-word;overflow-wrap:anywhere;max-width:100%}
.mt5-performance-summary .mt5-key-card{background:linear-gradient(135deg,rgba(242,199,106,.12),rgba(255,255,255,.04))}
.mt5-performance-summary .up{color:#58d878!important}.mt5-performance-summary .down{color:#ff6868!important}
@media(max-width:1100px){.mt5-performance-summary{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:620px){.mt5-performance-summary{grid-template-columns:1fr}}

/* Step 2.7 - keep MT5 analytics SVG visible */
#mt5EquityCurveChart svg,
#mt5DailyProfitChart svg{
  width:100%;
  height:auto;
  min-height:260px;
  display:block;
}
.mt5-chart-empty{
  min-height:240px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  border:1px dashed rgba(242,199,106,.28);
  border-radius:18px;
  color:rgba(226,235,245,.72);
  background:rgba(255,255,255,.035);
  font-weight:850;
}

/* Step 3.5 - Dashboard Portfolio Allocation */
#mt5AllocationChart svg,#mt5AllocationChart .mt5-allocation-widget{width:100%;min-height:260px;display:block}
.mt5-allocation-widget{display:grid;grid-template-columns:minmax(150px,210px) minmax(0,1fr);gap:16px;align-items:center;padding:8px;width:100%;height:100%}
.mt5-allocation-donut{width:min(210px,100%);aspect-ratio:1;border-radius:50%;display:grid;place-items:center;position:relative;margin:auto;box-shadow:inset 0 0 0 1px rgba(255,255,255,.10),0 20px 48px rgba(0,0,0,.28)}
.mt5-allocation-donut:after{content:"";position:absolute;inset:19%;border-radius:50%;background:linear-gradient(180deg,#071321,#020814);box-shadow:inset 0 0 28px rgba(0,0,0,.42)}
.mt5-allocation-donut>div{position:relative;z-index:1;text-align:center;display:grid;gap:3px;max-width:74%;overflow:hidden}
.mt5-allocation-donut strong{font-size:34px;line-height:1;color:#f2c76a;font-weight:1000;letter-spacing:-.04em}.mt5-allocation-donut span{font-size:12px;color:#f7fbff;font-weight:950;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mt5-allocation-legend{display:grid;gap:8px;min-width:0}.mt5-allocation-legend div{display:grid;grid-template-columns:12px minmax(0,1fr) auto;gap:9px;align-items:center;border:1px solid rgba(255,255,255,.08);background:rgba(255,255,255,.04);border-radius:14px;padding:8px 10px}.mt5-allocation-legend i{width:12px;height:12px;border-radius:50%}.mt5-allocation-legend span{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#f7fbff;font-size:12px;font-weight:950}.mt5-allocation-legend em{font-style:normal;color:#9fb0c3;font-size:10.5px;margin-left:4px}.mt5-allocation-legend strong{color:#f2c76a;font-size:12px;font-weight:1000}.mt5-allocation-summary{grid-column:1/-1;display:flex;justify-content:space-between;gap:10px;align-items:center;padding:9px 12px;border:1px solid rgba(242,199,106,.16);border-radius:14px;background:rgba(242,199,106,.06);color:#9fb0c3;font-size:12px;font-weight:900}.mt5-allocation-summary strong{color:#f2c76a}
@media(max-width:720px){.mt5-allocation-widget{grid-template-columns:1fr}.mt5-allocation-donut{width:184px}.mt5-allocation-summary{align-items:flex-start;flex-direction:column}}


/* Step 3.6 - Professional institutional allocation palette */
.professional-allocation{--alloc-card:rgba(7,18,32,.72);--alloc-line:rgba(214,170,79,.14);--alloc-muted:rgba(159,177,200,.86);--alloc-text:var(--text,#edf4ff);--alloc-gold:#d6aa4f;}
.professional-donut{filter:saturate(.84) contrast(.98);box-shadow:inset 0 0 0 1px rgba(255,255,255,.08), inset 0 0 34px rgba(2,8,20,.48), 0 18px 44px rgba(0,0,0,.22)!important;}
.professional-donut:before{content:"";position:absolute;inset:-1px;border-radius:50%;background:radial-gradient(circle at 42% 32%,rgba(255,255,255,.16),transparent 28%),radial-gradient(circle at 70% 80%,rgba(214,170,79,.10),transparent 30%);pointer-events:none;z-index:0;}
.professional-donut:after{background:linear-gradient(180deg,rgba(8,20,35,.96),rgba(2,8,20,.98))!important;box-shadow:inset 0 0 0 1px rgba(214,170,79,.10), inset 0 12px 28px rgba(0,0,0,.46)!important;}
.professional-donut strong{text-shadow:none!important;letter-spacing:-.035em!important;color:var(--alloc-gold)!important;}
.professional-donut span{letter-spacing:.015em;text-transform:uppercase;color:rgba(237,244,255,.88)!important;}
.professional-legend{gap:7px!important;}
.professional-legend div{border-color:rgba(214,170,79,.10)!important;background:linear-gradient(180deg,rgba(255,255,255,.045),rgba(255,255,255,.018))!important;box-shadow:inset 0 1px 0 rgba(255,255,255,.035);}
.professional-legend i{box-shadow:0 0 0 3px rgba(255,255,255,.035),0 6px 16px rgba(0,0,0,.22)!important;}
.professional-legend .allocation-name{display:grid!important;grid-template-columns:1fr!important;gap:1px!important;min-width:0!important;white-space:normal!important;overflow:hidden!important;}
.professional-legend .allocation-name b{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--alloc-text);font-weight:950;letter-spacing:.01em;}
.professional-legend .allocation-name em{display:block;margin:0!important;color:var(--alloc-muted)!important;font-size:10px!important;line-height:1.15;font-weight:800;text-transform:uppercase;letter-spacing:.06em;}
.professional-legend strong{color:var(--alloc-gold)!important;font-variant-numeric:tabular-nums;}
.professional-summary{border-color:rgba(214,170,79,.16)!important;background:linear-gradient(180deg,rgba(214,170,79,.065),rgba(214,170,79,.025))!important;}
.professional-summary strong{color:var(--alloc-gold)!important;}
html[data-theme="light"] .professional-allocation{--alloc-card:rgba(255,255,255,.84);--alloc-text:#09182a;--alloc-muted:#5e7187;}
html[data-theme="light"] .professional-donut:after{background:linear-gradient(180deg,rgba(255,255,255,.96),rgba(241,246,252,.98))!important;}
html[data-theme="light"] .professional-legend div{background:rgba(255,255,255,.78)!important;border-color:rgba(9,24,42,.10)!important;}

/* Step 3.6 - dashboard allocation legend readability */
.mt5-allocation-widget.professional-allocation{grid-template-columns:minmax(160px,210px) minmax(150px,1fr)!important;}
.mt5-allocation-widget.professional-allocation .mt5-allocation-donut{width:min(206px,100%)!important;}
.mt5-allocation-widget.professional-allocation .mt5-allocation-legend div{grid-template-columns:12px minmax(95px,1fr) auto!important;}
@media(max-width:720px){.mt5-allocation-widget.professional-allocation{grid-template-columns:1fr!important;}.mt5-allocation-widget.professional-allocation .mt5-allocation-donut{width:180px!important;}}

/* Step 3.7 - Allocation donut glow + legend overflow fix */
.professional-allocation{
  --alloc-glow-gold:rgba(242,199,106,.28);
  --alloc-glow-teal:rgba(79,154,149,.18);
  --alloc-glow-blue:rgba(91,127,166,.16);
  overflow:hidden;
}
.professional-donut{
  position:relative!important;
  isolation:isolate;
  overflow:visible!important;
  filter:saturate(.92) contrast(1.04) drop-shadow(0 0 18px rgba(242,199,106,.16))!important;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.10),
    inset 0 0 34px rgba(2,8,20,.52),
    0 0 0 1px rgba(242,199,106,.08),
    0 0 34px rgba(242,199,106,.16),
    0 18px 48px rgba(0,0,0,.30)!important;
}
.professional-donut:before{
  content:""!important;
  position:absolute!important;
  inset:-18px!important;
  border-radius:50%!important;
  background:
    radial-gradient(circle at 42% 28%,rgba(255,247,214,.36),transparent 20%),
    radial-gradient(circle at 50% 52%,var(--alloc-glow-gold),transparent 45%),
    radial-gradient(circle at 25% 78%,var(--alloc-glow-teal),transparent 34%),
    radial-gradient(circle at 78% 70%,var(--alloc-glow-blue),transparent 36%)!important;
  filter:blur(13px)!important;
  opacity:.78!important;
  z-index:-1!important;
  pointer-events:none!important;
}
.professional-donut:after{
  z-index:0!important;
  box-shadow:
    inset 0 0 0 1px rgba(242,199,106,.14),
    inset 0 16px 34px rgba(0,0,0,.50),
    0 0 22px rgba(242,199,106,.10)!important;
}
.professional-donut>div{z-index:2!important;}
.professional-donut strong{
  text-shadow:0 0 16px rgba(242,199,106,.26)!important;
}
.professional-legend{
  min-width:0!important;
  max-width:100%!important;
  overflow:hidden!important;
}
.professional-legend div{
  min-width:0!important;
  max-width:100%!important;
  grid-template-columns:11px minmax(0,1fr) minmax(44px,max-content)!important;
  overflow:hidden!important;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.025),0 8px 18px rgba(0,0,0,.16)!important;
}
.professional-legend i{
  box-shadow:0 0 12px currentColor,0 0 18px rgba(242,199,106,.12)!important;
}
.professional-legend .allocation-name{
  min-width:0!important;
  max-width:100%!important;
  overflow:hidden!important;
}
.professional-legend .allocation-name b{
  min-width:0!important;
  max-width:100%!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}
.professional-legend .allocation-name em{
  min-width:0!important;
  max-width:100%!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}
.professional-legend strong{
  min-width:44px!important;
  text-align:right!important;
  white-space:nowrap!important;
  overflow:visible!important;
  color:#f2c76a!important;
}
.professional-summary{
  overflow:hidden!important;
}
.professional-summary span{
  min-width:0!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}
.professional-summary strong{
  white-space:nowrap!important;
}
@media(max-width:720px){
  .professional-donut{filter:saturate(.92) contrast(1.02) drop-shadow(0 0 12px rgba(242,199,106,.14))!important;}
  .professional-donut:before{inset:-12px!important;filter:blur(10px)!important;opacity:.68!important;}
  .professional-legend div{grid-template-columns:10px minmax(0,1fr) minmax(42px,max-content)!important;padding-left:8px!important;padding-right:8px!important;}
}

/* Step 3.7 - Portfolio detail side allocation proportion fix */
.portfolio-full-card .allocation-card .allocation-widget.professional-allocation{
  grid-template-columns:minmax(126px,160px) minmax(0,1fr)!important;
  gap:10px!important;
  align-items:center!important;
}
.portfolio-full-card .allocation-card .allocation-donut,
.portfolio-full-card .allocation-card .professional-donut{
  width:min(158px,100%)!important;
}
.portfolio-full-card .allocation-card .allocation-legend div{
  padding:7px 8px!important;
  border-radius:13px!important;
}
.portfolio-full-card .allocation-card .allocation-summary,
.portfolio-full-card .allocation-card .professional-summary{
  padding:8px 10px!important;
}
@media(max-width:1180px){
  .portfolio-full-card .allocation-card .allocation-widget.professional-allocation{
    grid-template-columns:1fr!important;
  }
  .portfolio-full-card .allocation-card .allocation-donut,
  .portfolio-full-card .allocation-card .professional-donut{
    width:min(176px,64vw)!important;
  }
}

/* Step 3.8 - Allocation donut premium glow + hard overflow fix */
.professional-allocation{
  overflow:visible!important;
  min-width:0!important;
}
.professional-donut{
  overflow:visible!important;
  transform:translateZ(0);
  filter:saturate(.98) contrast(1.05) drop-shadow(0 0 18px rgba(242,199,106,.18)) drop-shadow(0 0 28px rgba(87,148,157,.12))!important;
}
.professional-donut:before{
  inset:-20px!important;
  opacity:.86!important;
  filter:blur(15px)!important;
}
.professional-donut>div{
  width:62%!important;
  max-width:62%!important;
  min-width:0!important;
  overflow:hidden!important;
  place-items:center!important;
}
.professional-donut strong{
  display:block!important;
  width:100%!important;
  max-width:100%!important;
  font-size:clamp(22px,2.55vw,33px)!important;
  line-height:.98!important;
  letter-spacing:-.055em!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:clip!important;
  text-align:center!important;
  text-shadow:0 0 18px rgba(242,199,106,.32),0 0 34px rgba(214,170,79,.16)!important;
}
.professional-donut span{
  width:100%!important;
  max-width:100%!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
  text-align:center!important;
}
.professional-legend{
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  overflow:visible!important;
  align-self:stretch!important;
}
.professional-legend div{
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  grid-template-columns:12px minmax(0,1fr) minmax(58px,64px)!important;
  gap:8px!important;
  overflow:hidden!important;
  padding:8px 9px!important;
  border-radius:14px!important;
}
.professional-legend .allocation-name{
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  min-width:0!important;
  overflow:hidden!important;
}
.professional-legend .allocation-name b,
.professional-legend .allocation-name em{
  min-width:0!important;
  max-width:100%!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}
.professional-legend strong{
  min-width:58px!important;
  max-width:64px!important;
  justify-self:end!important;
  text-align:right!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:clip!important;
  font-size:12.5px!important;
  letter-spacing:-.02em!important;
  font-variant-numeric:tabular-nums!important;
}
.professional-summary{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  overflow:hidden!important;
}

/* Portfolio detail right-side allocation card: stack donut above legend so text never clips */
.portfolio-full-card .allocation-card{
  overflow:visible!important;
}
.portfolio-full-card .allocation-card .allocation-widget.professional-allocation,
.portfolio-full-card .allocation-card .professional-allocation{
  display:grid!important;
  grid-template-columns:1fr!important;
  grid-template-areas:"donut" "legend" "summary"!important;
  gap:12px!important;
  align-items:center!important;
  justify-items:center!important;
  height:auto!important;
  overflow:visible!important;
}
.portfolio-full-card .allocation-card .allocation-donut,
.portfolio-full-card .allocation-card .professional-donut{
  grid-area:donut!important;
  width:min(178px,62vw)!important;
  margin:8px auto 4px!important;
}
.portfolio-full-card .allocation-card .allocation-legend,
.portfolio-full-card .allocation-card .professional-legend{
  grid-area:legend!important;
  display:grid!important;
  grid-template-columns:1fr!important;
  gap:8px!important;
  width:100%!important;
}
.portfolio-full-card .allocation-card .allocation-legend div,
.portfolio-full-card .allocation-card .professional-legend div{
  grid-template-columns:12px minmax(0,1fr) minmax(62px,68px)!important;
  padding:8px 10px!important;
}
.portfolio-full-card .allocation-card .allocation-summary,
.portfolio-full-card .allocation-card .professional-summary{
  grid-area:summary!important;
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  gap:10px!important;
  width:100%!important;
}

/* Community drawer / dashboard compact cards keep a balanced two-column layout only when enough space exists */
.community-allocation.professional-allocation,
.mt5-allocation-widget.professional-allocation{
  overflow:visible!important;
}
.community-allocation.professional-allocation .professional-legend div,
.mt5-allocation-widget.professional-allocation .professional-legend div{
  grid-template-columns:12px minmax(0,1fr) minmax(58px,64px)!important;
}

@media(max-width:900px){
  .professional-donut strong{font-size:clamp(21px,7vw,31px)!important;}
  .portfolio-full-card .allocation-card .allocation-widget.professional-allocation,
  .community-allocation.professional-allocation,
  .mt5-allocation-widget.professional-allocation{
    grid-template-columns:1fr!important;
    justify-items:center!important;
  }
  .professional-legend{width:100%!important;}
  .professional-legend div{grid-template-columns:11px minmax(0,1fr) minmax(56px,62px)!important;}
  .professional-legend strong{min-width:56px!important;max-width:62px!important;font-size:12px!important;}
}

/* Step 3.9 - Allocation typography downsize refinement */
.professional-donut>div{
  width:58%!important;
  max-width:58%!important;
}
.professional-donut strong{
  font-size:clamp(20px,2.2vw,30px)!important;
  line-height:1!important;
}
.professional-donut span{
  font-size:11px!important;
  line-height:1.1!important;
  letter-spacing:.02em!important;
}
.professional-legend div{
  grid-template-columns:10px minmax(0,1fr) minmax(50px,56px)!important;
  gap:7px!important;
  padding:7px 8px!important;
}
.professional-legend i{
  width:10px!important;
  height:10px!important;
}
.professional-legend .allocation-name b{
  font-size:11px!important;
  line-height:1.1!important;
}
.professional-legend .allocation-name em{
  font-size:9px!important;
  line-height:1.05!important;
}
.professional-legend strong{
  min-width:50px!important;
  max-width:56px!important;
  font-size:11px!important;
  letter-spacing:-.01em!important;
}
.professional-summary{
  font-size:11px!important;
}
.portfolio-full-card .allocation-card .allocation-donut,
.portfolio-full-card .allocation-card .professional-donut{
  width:min(170px,58vw)!important;
}
.portfolio-full-card .allocation-card .allocation-legend div,
.portfolio-full-card .allocation-card .professional-legend div{
  grid-template-columns:10px minmax(0,1fr) minmax(50px,56px)!important;
  padding:7px 8px!important;
}
@media (max-width: 720px){
  .professional-donut>div{
    width:56%!important;
    max-width:56%!important;
  }
  .professional-donut strong{
    font-size:clamp(18px,6.2vw,26px)!important;
  }
  .professional-donut span{
    font-size:10px!important;
  }
  .professional-legend div{
    grid-template-columns:10px minmax(0,1fr) minmax(46px,52px)!important;
    padding:7px 8px!important;
  }
  .professional-legend strong{
    min-width:46px!important;
    max-width:52px!important;
    font-size:10.5px!important;
  }
  .professional-legend .allocation-name b{
    font-size:10.5px!important;
  }
  .professional-legend .allocation-name em{
    font-size:8.5px!important;
  }
  .portfolio-full-card .allocation-card .allocation-donut,
  .portfolio-full-card .allocation-card .professional-donut{
    width:min(160px,56vw)!important;
  }
}


/* Step 3.11 - Editable public portfolio name */
.mt5-port-title strong{
  display:block;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.mt5-port-title span{
  display:block;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.mt5-public-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:7px;
  flex-wrap:wrap;
}
.mt5-title-edit{
  border:1px solid rgba(159,176,195,.16);
  background:rgba(255,255,255,.045);
  color:#c7d4e4;
  border-radius:999px;
  min-height:28px;
  padding:0 10px;
  font-size:10px;
  font-weight:950;
  cursor:pointer;
}
.mt5-title-edit:hover{
  border-color:rgba(242,199,106,.42);
  color:#f2c76a;
  background:rgba(242,199,106,.08);
}
html[data-theme="light"] .mt5-title-edit{
  background:#fff;
  color:#657386;
  border-color:#dbe3ee;
}
@media(max-width:720px){
  .mt5-visibility-actions{
    align-items:flex-start;
    flex-direction:column;
  }
  .mt5-public-actions{
    width:100%;
    justify-content:flex-start;
  }
}

/* Step 3.12 - In-site portfolio title editor modal */
.mt5-title-modal-backdrop{
  position:fixed;
  inset:0;
  z-index:2500;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
  background:rgba(0,0,0,.62);
  backdrop-filter:blur(10px);
  opacity:0;
  pointer-events:none;
  transition:opacity .18s ease;
}
.mt5-title-modal-backdrop.open{opacity:1;pointer-events:auto}
.mt5-title-modal{
  width:min(520px,100%);
  border-radius:26px;
  border:1px solid rgba(242,199,106,.22);
  background:radial-gradient(circle at 18% 0%,rgba(242,199,106,.16),transparent 34%),linear-gradient(180deg,rgba(9,24,42,.98),rgba(3,10,20,.98));
  box-shadow:0 34px 90px rgba(0,0,0,.58),inset 0 1px 0 rgba(255,255,255,.08);
  padding:24px;
  position:relative;
  color:#f7fbff;
  transform:translateY(12px) scale(.98);
  transition:transform .18s ease;
}
.mt5-title-modal-backdrop.open .mt5-title-modal{transform:translateY(0) scale(1)}
.mt5-title-modal-close{position:absolute;top:14px;right:14px;width:34px;height:34px;border-radius:13px;border:1px solid rgba(255,255,255,.12);background:rgba(255,255,255,.055);color:#c7d4e4;font-size:22px;line-height:1;cursor:pointer}
.mt5-title-modal-kicker{color:#f2c76a;font-size:11px;font-weight:1000;letter-spacing:.14em;text-transform:uppercase;margin-bottom:8px}
.mt5-title-modal h3{margin:0;font-size:26px;line-height:1.1;letter-spacing:-.04em}
.mt5-title-modal-desc{margin:10px 0 18px;color:#9fb0c3;line-height:1.65;font-weight:750}
.mt5-title-field{display:block}
.mt5-title-field span{display:block;color:#b8c8dd;font-size:12px;font-weight:950;letter-spacing:.05em;text-transform:uppercase;margin-bottom:8px}
.mt5-title-field input{width:100%;height:50px;border-radius:16px;border:1px solid rgba(242,199,106,.28);background:rgba(2,8,20,.72);color:#fff;outline:0;padding:0 15px;font:inherit;font-weight:900;box-shadow:inset 0 1px 0 rgba(255,255,255,.04)}
.mt5-title-field input:focus{border-color:rgba(242,199,106,.62);box-shadow:0 0 0 4px rgba(242,199,106,.08),inset 0 1px 0 rgba(255,255,255,.05)}
.mt5-title-count{text-align:right;margin-top:6px;color:#71849b;font-size:11px;font-weight:900}
.mt5-title-modal-error{margin-top:10px;border:1px solid rgba(255,104,104,.28);background:rgba(255,104,104,.09);color:#ff9fa1;border-radius:14px;padding:10px 12px;font-size:13px;font-weight:850}
.mt5-title-modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:18px}
.mt5-title-btn{min-height:42px;border-radius:14px;padding:0 16px;font-weight:1000;cursor:pointer;border:1px solid rgba(255,255,255,.12)}
.mt5-title-btn-ghost{background:rgba(255,255,255,.055);color:#d9e6f5}
.mt5-title-btn-gold{border-color:rgba(242,199,106,.42);background:linear-gradient(135deg,#ffd978,#c8952e);color:#171006;box-shadow:0 14px 30px rgba(200,149,46,.22)}
body.mt5-title-modal-open{overflow:hidden}
html[data-theme="light"] .mt5-title-modal{background:linear-gradient(180deg,#fff,#f5f8fc);color:#09182a;border-color:rgba(200,149,46,.28)}
html[data-theme="light"] .mt5-title-modal-desc,html[data-theme="light"] .mt5-title-count{color:#657386}
html[data-theme="light"] .mt5-title-field input{background:#fff;color:#09182a;border-color:rgba(200,149,46,.35)}
html[data-theme="light"] .mt5-title-btn-ghost,html[data-theme="light"] .mt5-title-modal-close{background:#fff;color:#09182a;border-color:#dbe3ee}
@media(max-width:560px){.mt5-title-modal-backdrop{align-items:flex-end;padding:10px}.mt5-title-modal{border-radius:24px;padding:22px 16px 16px}.mt5-title-modal-actions{display:grid;grid-template-columns:1fr}.mt5-title-btn{width:100%}}

/* Step 3.13 - Premium centered mobile portfolio title modal */
.mt5-title-modal-backdrop{
  --modal-safe-top: max(18px, env(safe-area-inset-top));
  --modal-safe-bottom: max(18px, env(safe-area-inset-bottom));
}
.mt5-title-modal{
  isolation:isolate;
}
.mt5-title-modal:before{
  content:"";
  position:absolute;
  inset:0;
  border-radius:inherit;
  pointer-events:none;
  background:
    radial-gradient(circle at 22% 0%,rgba(242,199,106,.18),transparent 34%),
    radial-gradient(circle at 78% 12%,rgba(85,150,165,.13),transparent 32%);
  opacity:.9;
  z-index:-1;
}
.mt5-title-modal:after{
  content:"";
  position:absolute;
  left:18px;
  right:18px;
  top:0;
  height:1px;
  background:linear-gradient(90deg,transparent,rgba(242,199,106,.55),transparent);
  pointer-events:none;
}
.mt5-title-modal-close{
  transition:transform .16s ease,border-color .16s ease,background .16s ease;
}
.mt5-title-modal-close:hover{
  transform:translateY(-1px);
  border-color:rgba(242,199,106,.32);
  background:rgba(242,199,106,.08);
}
.mt5-title-btn{
  transition:transform .16s ease,filter .16s ease,border-color .16s ease,background .16s ease;
}
.mt5-title-btn:hover{transform:translateY(-1px)}
.mt5-title-btn-gold:hover{filter:brightness(1.04)}

@media(max-width:560px){
  .mt5-title-modal-backdrop{
    align-items:center!important;
    justify-content:center!important;
    padding:var(--modal-safe-top) 12px var(--modal-safe-bottom)!important;
    background:
      radial-gradient(circle at 50% 42%,rgba(242,199,106,.10),transparent 34%),
      rgba(0,0,0,.68)!important;
    backdrop-filter:blur(14px) saturate(1.08)!important;
  }
  .mt5-title-modal{
    width:min(100%,390px)!important;
    max-height:calc(100dvh - var(--modal-safe-top) - var(--modal-safe-bottom))!important;
    overflow:auto!important;
    border-radius:26px!important;
    padding:22px 16px 16px!important;
    transform:translateY(8px) scale(.985)!important;
    box-shadow:
      0 28px 78px rgba(0,0,0,.64),
      0 0 0 1px rgba(242,199,106,.09),
      inset 0 1px 0 rgba(255,255,255,.08)!important;
  }
  .mt5-title-modal-backdrop.open .mt5-title-modal{
    transform:translateY(0) scale(1)!important;
  }
  .mt5-title-modal:before{
    background:
      radial-gradient(circle at 18% 0%,rgba(242,199,106,.20),transparent 38%),
      radial-gradient(circle at 100% 10%,rgba(83,145,164,.14),transparent 38%)!important;
  }
  .mt5-title-modal:after{
    left:48px!important;
    right:48px!important;
  }
  .mt5-title-modal-close{
    top:12px!important;
    right:12px!important;
    width:36px!important;
    height:36px!important;
    border-radius:14px!important;
  }
  .mt5-title-modal-kicker{
    font-size:10px!important;
    letter-spacing:.16em!important;
    margin-bottom:8px!important;
    padding-right:44px!important;
  }
  .mt5-title-modal h3{
    font-size:clamp(22px,7vw,28px)!important;
    line-height:1.05!important;
    padding-right:44px!important;
  }
  .mt5-title-modal-desc{
    margin:9px 0 16px!important;
    font-size:13px!important;
    line-height:1.55!important;
  }
  .mt5-title-field span{
    font-size:10.5px!important;
    margin-bottom:7px!important;
  }
  .mt5-title-field input{
    height:52px!important;
    border-radius:17px!important;
    padding:0 14px!important;
    font-size:15px!important;
    background:rgba(2,8,20,.82)!important;
  }
  .mt5-title-count{
    font-size:10.5px!important;
    margin-top:7px!important;
  }
  .mt5-title-modal-error{
    border-radius:14px!important;
    padding:9px 11px!important;
    font-size:12px!important;
  }
  .mt5-title-modal-actions{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:9px!important;
    margin-top:16px!important;
  }
  .mt5-title-btn{
    width:100%!important;
    min-height:46px!important;
    border-radius:16px!important;
    font-size:13.5px!important;
  }
  .mt5-title-btn-gold{
    order:1;
    box-shadow:0 14px 28px rgba(200,149,46,.24),0 0 0 1px rgba(255,255,255,.10) inset!important;
  }
  .mt5-title-btn-ghost{
    order:2;
    background:rgba(255,255,255,.045)!important;
  }
}

@media(max-width:380px){
  .mt5-title-modal-backdrop{padding-left:10px!important;padding-right:10px!important;}
  .mt5-title-modal{padding:20px 14px 14px!important;border-radius:24px!important;}
  .mt5-title-modal h3{font-size:24px!important;}
  .mt5-title-modal-desc{font-size:12.5px!important;}
}

@media(max-height:640px) and (max-width:560px){
  .mt5-title-modal-backdrop{align-items:center!important;}
  .mt5-title-modal{
    max-height:calc(100dvh - 20px)!important;
    padding-top:18px!important;
  }
  .mt5-title-modal h3{font-size:22px!important;}
  .mt5-title-modal-desc{margin-bottom:12px!important;}
  .mt5-title-btn{min-height:42px!important;}
}

/* =========================================================
   Step 4.4.2 - Member Portfolio Manager + Delete History
   ========================================================= */
.mt5-port-status.backtest{
  color:#f2c76a;
  background:rgba(242,199,106,.11);
  border-color:rgba(242,199,106,.25);
}
.mt5-port-status.backtest:before{background:#f2c76a;}
.mt5-backtest-port-card{
  border-color:rgba(242,199,106,.18);
  background:linear-gradient(135deg,rgba(5,18,33,.82),rgba(17,24,39,.72));
}
.mt5-delete-history-btn{
  appearance:none;
  border:1px solid rgba(255,104,104,.30);
  color:#ff9e9e;
  background:rgba(255,104,104,.08);
  min-height:30px;
  border-radius:999px;
  padding:6px 10px;
  font-size:11px;
  font-weight:950;
  cursor:pointer;
  transition:transform .16s ease, background .16s ease, border-color .16s ease;
}
.mt5-delete-history-btn:hover{
  transform:translateY(-1px);
  background:rgba(255,104,104,.14);
  border-color:rgba(255,104,104,.48);
}
.velaea-danger-modal-backdrop{
  position:fixed;
  inset:0;
  z-index:9999;
  display:none;
  align-items:center;
  justify-content:center;
  padding:18px;
  background:rgba(1,8,18,.62);
  backdrop-filter:blur(12px);
}
.velaea-danger-modal-backdrop.open{display:flex;}
body.velaea-danger-modal-open{overflow:hidden;}
.velaea-danger-modal{
  width:min(520px,100%);
  position:relative;
  border:1px solid rgba(255,104,104,.24);
  border-radius:22px;
  background:linear-gradient(180deg,rgba(8,20,36,.98),rgba(4,13,26,.98));
  box-shadow:0 30px 80px rgba(0,0,0,.42),0 0 0 1px rgba(242,199,106,.08) inset;
  padding:24px;
}
.velaea-danger-close{
  position:absolute;
  right:14px;
  top:12px;
  width:34px;
  height:34px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.04);
  color:#fff;
  font-size:20px;
  cursor:pointer;
}
.velaea-danger-kicker{
  color:#f2c76a;
  font-size:11px;
  font-weight:950;
  letter-spacing:.12em;
  text-transform:uppercase;
  margin-bottom:8px;
}
.velaea-danger-modal h3{
  margin:0 36px 10px 0;
  color:#fff;
  font-size:22px;
  line-height:1.2;
}
.velaea-danger-modal p{
  margin:0;
  color:#b9c8dc;
  font-size:14px;
  line-height:1.65;
}
.velaea-danger-actions{
  margin-top:18px;
  display:flex;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
}
.velaea-danger-btn{
  min-height:42px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  padding:0 16px;
  font-size:13px;
  font-weight:950;
  cursor:pointer;
}
.velaea-danger-btn.ghost{background:rgba(255,255,255,.05);color:#dbe8f6;}
.velaea-danger-btn.danger{background:linear-gradient(180deg,#ff7373,#c43131);border-color:rgba(255,104,104,.55);color:#fff;box-shadow:0 12px 28px rgba(196,49,49,.28);}
body.light-mode .mt5-backtest-port-card,html[data-theme="light"] body .mt5-backtest-port-card{background:linear-gradient(135deg,#ffffff,#fff9ed);border-color:rgba(200,149,46,.22);}
body.light-mode .velaea-danger-modal,html[data-theme="light"] body .velaea-danger-modal{background:linear-gradient(180deg,#ffffff,#fffaf0);border-color:rgba(196,49,49,.18);}
body.light-mode .velaea-danger-modal h3,html[data-theme="light"] body .velaea-danger-modal h3{color:#061a2f;}
body.light-mode .velaea-danger-modal p,html[data-theme="light"] body .velaea-danger-modal p{color:#546477;}

/* =========================================================
   Step 4.5.2 - Dashboard Backtest History Display
   ========================================================= */
.dashboard-backtest-panel{
  margin-top:18px;
}
.dashboard-backtest-head{
  align-items:flex-start;
  gap:18px;
}
.dashboard-backtest-kicker{
  display:inline-flex;
  color:var(--gold);
  font-size:11px;
  font-weight:950;
  letter-spacing:.14em;
  text-transform:uppercase;
  margin-bottom:6px;
}
.dashboard-backtest-head h2{
  margin:0;
  color:var(--heading);
  font-size:24px;
  letter-spacing:-.02em;
}
.dashboard-backtest-head p{
  margin:6px 0 0;
  color:var(--muted);
  font-size:13px;
  font-weight:800;
  line-height:1.6;
}
.dashboard-backtest-head-actions{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.dashboard-backtest-count{
  display:inline-flex;
  align-items:center;
  min-height:34px;
  padding:0 13px;
  border-radius:999px;
  border:1px solid rgba(200,149,46,.25);
  background:rgba(200,149,46,.09);
  color:var(--gold);
  font-size:12px;
  font-weight:950;
}
.dashboard-backtest-summary{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
  margin:16px 0;
}
.dashboard-backtest-summary div{
  border:1px solid rgba(148,163,184,.16);
  background:linear-gradient(180deg,rgba(255,255,255,.07),rgba(255,255,255,.03));
  border-radius:16px;
  padding:13px 14px;
  box-shadow:0 14px 35px rgba(0,0,0,.12);
}
.dashboard-backtest-summary label{
  display:block;
  color:var(--muted);
  font-size:10px;
  font-weight:950;
  letter-spacing:.08em;
  text-transform:uppercase;
  margin-bottom:5px;
}
.dashboard-backtest-summary strong{
  color:var(--heading);
  font-size:22px;
  font-weight:950;
}
.dashboard-backtest-list{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
  margin-top:14px;
}
.dashboard-backtest-card{
  border:1px solid rgba(200,149,46,.18);
  background:
    radial-gradient(circle at 20% 0%,rgba(242,199,106,.09),transparent 34%),
    linear-gradient(180deg,rgba(8,25,45,.94),rgba(5,15,28,.92));
  border-radius:22px;
  padding:16px;
  box-shadow:0 18px 50px rgba(0,0,0,.18);
}
.dashboard-backtest-card-top{
  display:flex;
  justify-content:space-between;
  gap:14px;
  align-items:flex-start;
}
.dashboard-backtest-type{
  display:inline-flex;
  color:#f2c76a;
  font-size:10px;
  font-weight:950;
  letter-spacing:.08em;
  text-transform:uppercase;
  margin-bottom:6px;
}
.dashboard-backtest-card h3{
  margin:0;
  color:#fff;
  font-size:18px;
  font-weight:950;
  letter-spacing:-.02em;
}
.dashboard-backtest-card p{
  margin:5px 0 0;
  color:#a9bdd5;
  font-size:12px;
  font-weight:850;
}
.dashboard-backtest-visibility{
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
  padding:0 10px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,.18);
  background:rgba(255,255,255,.06);
  color:#c8d6e8;
  font-size:10px;
  font-weight:950;
}
.dashboard-backtest-visibility.is-public{
  color:#7dffae;
  border-color:rgba(88,216,120,.28);
  background:rgba(88,216,120,.10);
}
.dashboard-backtest-metrics{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
  margin:15px 0;
}
.dashboard-backtest-metrics div{
  border:1px solid rgba(148,163,184,.16);
  border-radius:14px;
  padding:10px;
  background:rgba(255,255,255,.045);
}
.dashboard-backtest-metrics label{
  display:block;
  color:#90a7c0;
  font-size:10px;
  font-weight:950;
  text-transform:uppercase;
  margin-bottom:4px;
}
.dashboard-backtest-metrics strong{
  display:block;
  color:#fff;
  font-size:15px;
  font-weight:950;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.dashboard-backtest-metrics strong.up{color:#67ff9a;}
.dashboard-backtest-metrics strong.down{color:#ff7373;}
.dashboard-backtest-actions{
  display:flex;
  gap:9px;
  align-items:center;
  flex-wrap:wrap;
  margin-top:10px;
}
.dashboard-backtest-actions .btn{
  min-height:36px;
  padding:0 14px;
  border-radius:12px;
  font-size:12px;
  font-weight:950;
  text-decoration:none;
}
.dashboard-backtest-actions .btn.danger{
  border:1px solid rgba(255,92,92,.28);
  background:rgba(255,92,92,.09);
  color:#ff9b9b;
}
.dashboard-backtest-note{
  margin-top:12px;
  color:#8ea3bd;
  font-size:11px;
  font-weight:850;
  line-height:1.55;
}
.dashboard-backtest-empty{
  grid-column:1/-1;
  display:grid;
  place-items:center;
  text-align:center;
  min-height:150px;
  border:1px dashed rgba(200,149,46,.28);
  border-radius:20px;
  background:rgba(200,149,46,.055);
  color:var(--muted);
  padding:22px;
  gap:8px;
}
.dashboard-backtest-empty strong{
  color:var(--heading);
  font-size:18px;
  font-weight:950;
}
.dashboard-backtest-empty span{
  max-width:620px;
  line-height:1.65;
  font-size:13px;
  font-weight:800;
}
.dashboard-backtest-empty a{
  color:var(--gold);
  font-weight:950;
}
body.light-mode .dashboard-backtest-card,
html[data-theme="light"] body .dashboard-backtest-card{
  background:linear-gradient(180deg,#ffffff,#fffaf1);
  border-color:rgba(200,149,46,.24);
  box-shadow:0 18px 44px rgba(15,23,42,.08);
}
body.light-mode .dashboard-backtest-card h3,
html[data-theme="light"] body .dashboard-backtest-card h3,
body.light-mode .dashboard-backtest-metrics strong,
html[data-theme="light"] body .dashboard-backtest-metrics strong{
  color:#071525;
}
body.light-mode .dashboard-backtest-card p,
html[data-theme="light"] body .dashboard-backtest-card p,
body.light-mode .dashboard-backtest-note,
html[data-theme="light"] body .dashboard-backtest-note{
  color:#5d6d82;
}
body.light-mode .dashboard-backtest-metrics div,
html[data-theme="light"] body .dashboard-backtest-metrics div,
body.light-mode .dashboard-backtest-summary div,
html[data-theme="light"] body .dashboard-backtest-summary div{
  background:#ffffff;
  border-color:rgba(15,23,42,.10);
}
@media(max-width:900px){
  .dashboard-backtest-summary,
  .dashboard-backtest-list{
    grid-template-columns:1fr;
  }
  .dashboard-backtest-head-actions{
    width:100%;
    justify-content:flex-start;
    margin-left:0;
  }
}
@media(max-width:560px){
  .dashboard-backtest-metrics{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .dashboard-backtest-actions .btn{
    flex:1 1 auto;
    justify-content:center;
  }
}


/* =========================================================
   Step 4.5.3 - Dashboard Backtest Analytics Full Integration
   Backtest charts in the main member dashboard, styled to match Forward Test.
========================================================= */
.dashboard-backtest-analytics-extra{
  margin-top:18px;
  display:block;
}
.dashboard-backtest-analytics-extra[hidden]{
  display:none!important;
}
.dashboard-backtest-detail-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
  margin-top:14px;
}
.dashboard-backtest-info-card{
  border:1px solid rgba(255,255,255,.08);
  border-radius:20px;
  background:
    radial-gradient(circle at 18% 18%,rgba(242,199,106,.09),transparent 30%),
    linear-gradient(180deg,rgba(9,24,42,.72),rgba(7,17,31,.54));
  box-shadow:0 18px 48px rgba(0,0,0,.18);
  padding:16px;
  min-height:180px;
}
.dashboard-backtest-info-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin-top:14px;
}
.dashboard-bt-info-row{
  border:1px solid rgba(255,255,255,.075);
  border-radius:14px;
  background:rgba(255,255,255,.035);
  padding:10px 12px;
  min-width:0;
}
.dashboard-bt-info-row span{
  display:block;
  color:var(--muted);
  font-size:10px;
  font-weight:950;
  text-transform:uppercase;
  letter-spacing:.06em;
  margin-bottom:5px;
}
.dashboard-bt-info-row strong{
  display:block;
  color:var(--text);
  font-size:13px;
  font-weight:950;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.dashboard-bt-info-row.up strong{color:var(--green)}
.dashboard-bt-info-row.down strong{color:var(--red)}

.dashboard-bt-svg{
  width:100%;
  height:100%;
  min-height:270px;
  display:block;
  filter:drop-shadow(0 0 14px rgba(242,199,106,.12));
}
.dashboard-bt-svg .grid line{
  stroke:rgba(255,255,255,.08);
  stroke-width:1;
  stroke-dasharray:4 7;
}
.dashboard-bt-axis{
  fill:var(--muted);
  font-size:11px;
  font-weight:850;
}
.dashboard-bt-svg .grid-x line{
  stroke:rgba(255,255,255,.045);
  stroke-width:1;
}
.dashboard-bt-x-axis{
  fill:var(--muted);
}
.dashboard-bt-tick-dot{
  fill:rgba(242,199,106,.78);
}
.dashboard-bt-drawdown .dashboard-bt-dd-area{
  fill:rgba(255,104,104,.18);
}
.dashboard-bt-drawdown .dashboard-bt-dd-line{
  fill:none;
  stroke:#ff6868;
  stroke-width:3.2;
  stroke-linecap:round;
  stroke-linejoin:round;
  filter:drop-shadow(0 0 12px rgba(255,104,104,.30));
}
.dashboard-bt-chart-meta{
  display:flex;
  justify-content:space-between;
  gap:12px;
  border-top:1px solid rgba(255,255,255,.07);
  padding:10px 12px 0;
  color:var(--muted);
  font-size:11px;
  font-weight:900;
}
.dashboard-bt-chart-meta b{
  color:var(--text);
}
.dashboard-bt-chart-meta b.down{
  color:var(--red);
}

.dashboard-bt-month-scroll{
  display:flex;
  align-items:flex-end;
  gap:16px;
  min-height:260px;
  height:100%;
  padding:26px 20px 18px;
  overflow-x:auto;
  overflow-y:hidden;
  scrollbar-width:thin;
}
.dashboard-bt-month{
  min-width:54px;
  height:224px;
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
  align-items:center;
  gap:8px;
  position:relative;
}
.dashboard-bt-month b{
  color:var(--green);
  font-size:11px;
  font-weight:950;
  white-space:nowrap;
}
.dashboard-bt-month b.down{
  color:var(--red);
}
.dashboard-bt-month i{
  width:34px;
  border-radius:10px 10px 5px 5px;
  background:linear-gradient(180deg,rgba(88,216,120,.98),rgba(88,216,120,.46));
  box-shadow:0 10px 24px rgba(88,216,120,.16);
}
.dashboard-bt-month.neg i{
  background:linear-gradient(180deg,rgba(255,104,104,.95),rgba(255,104,104,.42));
  box-shadow:0 10px 24px rgba(255,104,104,.16);
}
.dashboard-bt-month span{
  color:var(--muted);
  font-size:10px;
  font-weight:900;
  white-space:nowrap;
}
.mt5-port-card.mt5-backtest-port-card.active,
.dashboard-backtest-card.active{
  border-color:rgba(242,199,106,.42)!important;
  box-shadow:
    0 0 0 1px rgba(242,199,106,.12),
    0 18px 42px rgba(242,199,106,.08),
    0 18px 42px rgba(0,0,0,.18)!important;
}
.mt5-port-card.mt5-backtest-port-card{
  cursor:pointer;
}
.dashboard-backtest-card{
  cursor:pointer;
}
.mt5-analytics-card strong.down,
.mt5-analytics-card strong.negative,
.dashboard-bt-info-row strong.negative{color:var(--red)!important}
.mt5-analytics-card strong.up,
.mt5-analytics-card strong.positive,
.dashboard-bt-info-row strong.positive{color:var(--green)!important}

html[data-theme="light"] .dashboard-backtest-info-card{
  background:
    radial-gradient(circle at 18% 18%,rgba(242,199,106,.14),transparent 32%),
    linear-gradient(180deg,#ffffff,#f8fbff);
  border-color:rgba(15,23,42,.10);
  box-shadow:0 18px 48px rgba(15,23,42,.08);
}
html[data-theme="light"] .dashboard-bt-info-row{
  background:#ffffff;
  border-color:rgba(15,23,42,.09);
}
html[data-theme="light"] .dashboard-bt-svg .grid line{
  stroke:rgba(15,23,42,.09);
}
html[data-theme="light"] .dashboard-bt-axis{
  fill:#64748b;
}
html[data-theme="light"] .dashboard-bt-svg .grid-x line{
  stroke:rgba(15,23,42,.05);
}
html[data-theme="light"] .dashboard-bt-tick-dot{
  fill:rgba(212,163,59,.72);
}

@media(max-width:980px){
  .dashboard-backtest-detail-grid{
    grid-template-columns:1fr;
  }
  .dashboard-backtest-info-grid{
    grid-template-columns:1fr;
  }
}
@media(max-width:640px){
  .dashboard-bt-month-scroll{
    gap:12px;
    padding-inline:12px;
  }
  .dashboard-bt-month{
    min-width:48px;
  }
}



/* =========================================================
   VELAEA Dashboard Trade Distribution fit fix
   แก้กราฟวงกลม/รายการสัดส่วนในกล่อง Trade Distribution ไม่ให้ล้นกรอบ
   เฉพาะกล่อง #mt5AllocationChart ในหน้า dashboard.html
========================================================= */
#mt5AllocationChart.mt5-allocation-chart{
  height:auto!important;
  min-height:370px!important;
  padding:14px 16px 16px!important;
  overflow:visible!important;
}

#mt5AllocationChart .mt5-allocation-widget.professional-allocation,
#mt5AllocationChart .mt5-allocation-widget{
  display:grid!important;
  grid-template-columns:1fr!important;
  grid-template-rows:auto auto auto!important;
  gap:10px!important;
  align-content:start!important;
  justify-items:center!important;
  width:100%!important;
  height:auto!important;
  min-height:0!important;
  padding:6px!important;
  overflow:visible!important;
}

#mt5AllocationChart .mt5-allocation-donut,
#mt5AllocationChart .professional-donut{
  width:min(184px,62%)!important;
  max-width:184px!important;
  margin:4px auto 8px!important;
}

#mt5AllocationChart .professional-donut:before{
  inset:-14px!important;
  filter:blur(11px)!important;
  opacity:.68!important;
}

#mt5AllocationChart .professional-donut>div{
  width:58%!important;
  max-width:58%!important;
}

#mt5AllocationChart .professional-donut strong{
  font-size:clamp(22px,2.15vw,30px)!important;
  line-height:1!important;
}

#mt5AllocationChart .professional-donut span{
  font-size:10.5px!important;
  line-height:1.08!important;
}

#mt5AllocationChart .mt5-allocation-legend,
#mt5AllocationChart .professional-legend{
  display:grid!important;
  grid-template-columns:1fr!important;
  gap:7px!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  overflow:visible!important;
}

#mt5AllocationChart .mt5-allocation-legend div,
#mt5AllocationChart .professional-legend div{
  display:grid!important;
  grid-template-columns:10px minmax(0,1fr) minmax(52px,58px)!important;
  align-items:center!important;
  gap:8px!important;
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  min-height:34px!important;
  padding:7px 9px!important;
  border-radius:13px!important;
  overflow:hidden!important;
}

#mt5AllocationChart .professional-legend i{
  width:10px!important;
  height:10px!important;
}

#mt5AllocationChart .professional-legend .allocation-name{
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  min-width:0!important;
  overflow:hidden!important;
}

#mt5AllocationChart .professional-legend .allocation-name b{
  font-size:10.8px!important;
  line-height:1.12!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}

#mt5AllocationChart .professional-legend .allocation-name em{
  font-size:8.8px!important;
  line-height:1.05!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}

#mt5AllocationChart .professional-legend strong{
  justify-self:end!important;
  min-width:52px!important;
  max-width:58px!important;
  text-align:right!important;
  font-size:10.8px!important;
  line-height:1!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:clip!important;
  font-variant-numeric:tabular-nums!important;
}

#mt5AllocationChart .mt5-allocation-summary,
#mt5AllocationChart .professional-summary{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  align-items:center!important;
  gap:10px!important;
  width:100%!important;
  max-width:100%!important;
  min-height:32px!important;
  padding:8px 10px!important;
  overflow:hidden!important;
}

#mt5AllocationChart .professional-summary span{
  min-width:0!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}

#mt5AllocationChart .professional-summary strong{
  white-space:nowrap!important;
  font-size:11px!important;
}

@media (min-width:1500px){
  #mt5AllocationChart.mt5-allocation-chart{
    min-height:390px!important;
  }
  #mt5AllocationChart .mt5-allocation-donut,
  #mt5AllocationChart .professional-donut{
    width:min(196px,64%)!important;
    max-width:196px!important;
  }
}

@media (max-width:1100px){
  #mt5AllocationChart.mt5-allocation-chart{
    min-height:0!important;
  }
}

@media (max-width:620px){
  #mt5AllocationChart.mt5-allocation-chart{
    padding:12px!important;
  }
  #mt5AllocationChart .mt5-allocation-donut,
  #mt5AllocationChart .professional-donut{
    width:min(170px,62vw)!important;
    max-width:170px!important;
  }
}

/* VELAEA Trade Detail Fields - safe responsive table extension */
.mt5-table-wrap{overflow-x:auto!important;}
.mt5-table-wrap table{min-width:1180px;}
.mt5-table-wrap th,.mt5-table-wrap td{white-space:nowrap;}


/* =========================================================
   Backtest analytics selected badge polish
   Fix light-mode washed-out badge: "Backtest: ... • SYMBOL TF"
   Scoped only to the analytics status pill.
   ========================================================= */
.mt5-analytics-status{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  max-width:min(100%,420px);
  min-height:34px;
  padding:8px 14px;
  border-radius:999px;
  border:1px solid rgba(242,199,106,.28);
  background:
    linear-gradient(135deg,rgba(242,199,106,.14),rgba(255,255,255,.045)),
    rgba(7,18,32,.72);
  color:#f6d37b;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.08),
    0 12px 28px rgba(0,0,0,.16);
  font-size:12px;
  font-weight:950;
  line-height:1.25;
  letter-spacing:-.01em;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
html[data-theme="light"] .mt5-analytics-status{
  background:
    linear-gradient(135deg,rgba(255,255,255,.98),rgba(255,248,230,.92));
  color:#9a6600;
  border-color:rgba(196,139,29,.34);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),
    0 10px 24px rgba(158,109,18,.10);
  text-shadow:none;
}
html[data-theme="dark"] .mt5-analytics-status,
body.dark .mt5-analytics-status{
  background:
    linear-gradient(135deg,rgba(242,199,106,.16),rgba(255,255,255,.035)),
    rgba(10,21,35,.82);
  color:#ffe2a0;
  border-color:rgba(242,199,106,.34);
}
@media(max-width:720px){
  .mt5-analytics-status{
    max-width:100%;
    white-space:normal;
    text-align:center;
  }
}


/* =========================================================
   FORCE FIX: Backtest selected badge readability
   Target: #mt5AnalyticsStatus only
   Reason: previous generic .mt5-analytics-status was overridden by later styles/cache.
   ========================================================= */
#mt5AnalyticsStatus.mt5-analytics-status,
span#mt5AnalyticsStatus.mt5-analytics-status{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  max-width:min(100%,460px)!important;
  min-height:34px!important;
  padding:8px 15px!important;
  border-radius:999px!important;
  border:1px solid rgba(190,132,22,.36)!important;
  background:linear-gradient(135deg,#ffffff 0%,#fff7df 100%)!important;
  color:#8b5a00!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.98),0 12px 26px rgba(150,103,18,.12)!important;
  text-shadow:none!important;
  filter:none!important;
  opacity:1!important;
  font-size:12px!important;
  font-weight:950!important;
  line-height:1.25!important;
  letter-spacing:-.01em!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
html[data-theme="dark"] #mt5AnalyticsStatus.mt5-analytics-status,
body.dark #mt5AnalyticsStatus.mt5-analytics-status,
[data-theme="dark"] #mt5AnalyticsStatus.mt5-analytics-status{
  border-color:rgba(242,199,106,.36)!important;
  background:linear-gradient(135deg,rgba(242,199,106,.18),rgba(255,255,255,.045)),rgba(10,21,35,.86)!important;
  color:#ffe4a8!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08),0 12px 28px rgba(0,0,0,.22)!important;
}
@media(max-width:720px){
  #mt5AnalyticsStatus.mt5-analytics-status{
    max-width:100%!important;
    white-space:normal!important;
    text-align:center!important;
  }
}



/* =========================================================
   Drawdown max point marker - professional callout
   ========================================================= */
.dashboard-bt-dd-callout{
  stroke:#ff6868;
  stroke-width:1.15;
  stroke-dasharray:4 4;
  opacity:.72;
}
.dashboard-bt-dd-max-dot{
  fill:#ff6868;
  stroke:rgba(2,8,20,.72);
  stroke-width:2;
  filter:drop-shadow(0 0 12px rgba(255,104,104,.48));
}
.dashboard-bt-dd-max-dot.halo{
  fill:rgba(255,104,104,.16);
  stroke:rgba(255,104,104,.36);
  stroke-width:1;
  filter:none;
}
.dashboard-bt-dd-max-label rect{
  fill:rgba(255,104,104,.13);
  stroke:rgba(255,104,104,.46);
  stroke-width:1.1;
  filter:drop-shadow(0 10px 20px rgba(0,0,0,.18));
}
.dashboard-bt-dd-max-label text{
  fill:#ff8f8f;
  font-size:11px;
  font-weight:1000;
  letter-spacing:-.01em;
  paint-order:stroke;
  stroke:rgba(2,8,20,.84);
  stroke-width:3.1px;
  stroke-linejoin:round;
}
html[data-theme="light"] .dashboard-bt-dd-max-dot,
body.light .dashboard-bt-dd-max-dot{
  stroke:rgba(255,255,255,.95);
}
html[data-theme="light"] .dashboard-bt-dd-max-label rect,
body.light .dashboard-bt-dd-max-label rect{
  fill:rgba(255,255,255,.92);
  stroke:rgba(255,104,104,.42);
  filter:drop-shadow(0 10px 20px rgba(255,104,104,.13));
}
html[data-theme="light"] .dashboard-bt-dd-max-label text,
body.light .dashboard-bt-dd-max-label text{
  fill:#c64242;
  stroke:rgba(255,255,255,.96);
}
html[data-theme="light"] .dashboard-bt-dd-callout,
body.light .dashboard-bt-dd-callout{
  stroke:rgba(214,72,72,.62);
}


/* =========================================================
   Drawdown max label date line polish
   ========================================================= */
.dashboard-bt-dd-max-label text.value{
  font-size:11px;
  font-weight:1000;
}
.dashboard-bt-dd-max-label text.date{
  fill:rgba(255,210,210,.82);
  font-size:10px;
  font-weight:900;
  letter-spacing:.01em;
  paint-order:stroke;
  stroke:rgba(2,8,20,.84);
  stroke-width:2.8px;
  stroke-linejoin:round;
}
html[data-theme="light"] .dashboard-bt-dd-max-label text.date,
body.light .dashboard-bt-dd-max-label text.date{
  fill:#8f5b5b;
  stroke:rgba(255,255,255,.96);
}



/* =========================================================
   VELAEA dual star scores: quality + risk safety
   Scoped component for graph/showcase cards only.
   5 stars = best, half star = minimum.
   ========================================================= */
.velaea-star-strip{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px;
  margin:10px 0 12px;
}
.velaea-star-box{
  min-width:0;
  border:1px solid rgba(255,255,255,.10);
  border-radius:16px;
  padding:9px 10px;
  background:linear-gradient(135deg,rgba(255,255,255,.055),rgba(255,255,255,.025));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05);
}
.velaea-star-box .star-title{
  display:block;
  color:var(--muted,#9fb0c9);
  font-size:9.5px;
  font-weight:1000;
  letter-spacing:.06em;
  text-transform:uppercase;
  margin-bottom:3px;
}
.velaea-star-set{
  display:inline-flex;
  align-items:center;
  gap:1px;
  line-height:1;
  white-space:nowrap;
  vertical-align:middle;
}
.velaea-star-set i{
  position:relative;
  display:inline-block;
  width:13px;
  color:rgba(148,163,184,.24);
  font-style:normal;
  font-size:13.5px;
  line-height:1;
  text-shadow:none;
}
.velaea-star-set i.full{
  color:var(--star-color,#f2c76a);
  text-shadow:0 0 12px var(--star-glow,rgba(242,199,106,.38));
}
.velaea-star-set i.half{
  color:rgba(148,163,184,.24);
}
.velaea-star-set i.half:before{
  content:"★";
  position:absolute;
  inset:0 auto 0 0;
  width:50%;
  overflow:hidden;
  color:var(--star-color,#f2c76a);
  text-shadow:0 0 12px var(--star-glow,rgba(242,199,106,.38));
}
.velaea-star-set.quality-stars{
  --star-color:#f2c76a;
  --star-glow:rgba(242,199,106,.42);
}
.velaea-star-set.risk-stars{
  --star-color:#64d7ff;
  --star-glow:rgba(100,215,255,.38);
}
.velaea-star-box b{
  display:inline-block;
  margin-left:6px;
  color:#f8fafc;
  font-size:11px;
  font-weight:1000;
  vertical-align:middle;
}
.velaea-star-box small{
  display:block;
  margin-top:4px;
  color:var(--muted,#9fb0c9);
  font-size:9.5px;
  font-weight:850;
  line-height:1.25;
  white-space:normal;
}
.velaea-star-box.quality{
  border-color:rgba(242,199,106,.20);
}
.velaea-star-box.risk{
  border-color:rgba(100,215,255,.18);
}
html[data-theme="light"] .velaea-star-box,
body.light .velaea-star-box{
  border-color:rgba(15,23,42,.085);
  background:linear-gradient(135deg,rgba(255,255,255,.98),rgba(248,250,252,.86));
  box-shadow:0 10px 24px rgba(15,23,42,.045),inset 0 1px 0 rgba(255,255,255,.96);
}
html[data-theme="light"] .velaea-star-box.quality,
body.light .velaea-star-box.quality{
  border-color:rgba(196,139,29,.20);
}
html[data-theme="light"] .velaea-star-box.risk,
body.light .velaea-star-box.risk{
  border-color:rgba(14,116,144,.18);
}
html[data-theme="light"] .velaea-star-box .star-title,
body.light .velaea-star-box .star-title{
  color:#64748b;
}
html[data-theme="light"] .velaea-star-box b,
body.light .velaea-star-box b{
  color:#0f172a;
}
html[data-theme="light"] .velaea-star-box small,
body.light .velaea-star-box small{
  color:#64748b;
}
html[data-theme="light"] .velaea-star-set i,
body.light .velaea-star-set i{
  color:rgba(148,163,184,.30);
}
@media(max-width:620px){
  .velaea-star-strip{
    grid-template-columns:1fr;
  }
}



.velaea-star-rating-host{
  margin:0 12px 4px;
}
.mt5-chart-box .velaea-star-strip{
  margin-top:0;
}



/* =========================================================
   Dual star score readability fix
   - Empty star uses ☆, not filled ★
   - Extreme risk can show 0.5/5 clearly
   ========================================================= */
.velaea-star-set i.empty{
  color:rgba(148,163,184,.34);
  text-shadow:none;
}
html[data-theme="light"] .velaea-star-set i.empty,
body.light .velaea-star-set i.empty{
  color:rgba(100,116,139,.36);
}
.velaea-star-set i.half{
  color:rgba(148,163,184,.22);
}
html[data-theme="light"] .velaea-star-set i.half,
body.light .velaea-star-set i.half{
  color:rgba(100,116,139,.28);
}



/* VELAEA Score Thai explanation dropdown */
.velaea-score-rule{
  margin-top:7px;
  border-top:1px solid rgba(255,255,255,.08);
  padding-top:6px;
}
.velaea-score-rule summary{
  list-style:none;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  color:var(--gold,#f2c76a);
  font-size:9.5px;
  font-weight:1000;
  letter-spacing:.02em;
}
.velaea-score-rule summary::-webkit-details-marker{display:none}
.velaea-score-rule summary:after{
  content:"+";
  display:grid;
  place-items:center;
  width:16px;
  height:16px;
  border-radius:999px;
  color:#08111f;
  background:rgba(242,199,106,.88);
  font-size:12px;
  line-height:1;
}
.velaea-score-rule[open] summary:after{content:"−"}
.velaea-score-rule div{
  display:grid;
  gap:4px;
  margin-top:7px;
}
.velaea-score-rule span{
  display:block;
  color:var(--muted,#9fb0c9);
  font-size:9.5px;
  font-weight:780;
  line-height:1.35;
}
html[data-theme="light"] .velaea-score-rule,
body.light .velaea-score-rule{
  border-top-color:rgba(15,23,42,.08);
}
html[data-theme="light"] .velaea-score-rule summary,
body.light .velaea-score-rule summary{
  color:#b7791f;
}
html[data-theme="light"] .velaea-score-rule span,
body.light .velaea-score-rule span{
  color:#64748b;
}



/* Strategy Safety + Drawdown Safety score boxes */
.velaea-star-strip.three-scores{
  grid-template-columns:repeat(3,minmax(0,1fr));
}
.velaea-star-set.dd-stars{
  --star-color:#a78bfa;
  --star-glow:rgba(167,139,250,.40);
}
.velaea-star-box.dd-safety{
  border-color:rgba(167,139,250,.22);
}
.velaea-star-box.strategy-safety{
  border-color:rgba(100,215,255,.20);
}
.velaea-score-rule.dd-rule summary{
  color:#c4b5fd;
}
.velaea-score-rule.dd-rule summary:after{
  background:linear-gradient(135deg,#ddd6fe,#a78bfa);
}
.velaea-score-rule.strategy-rule summary{
  color:#64d7ff;
}
.velaea-score-rule.strategy-rule summary:after{
  background:linear-gradient(135deg,#bfdbfe,#64d7ff);
}
html[data-theme="light"] .velaea-star-box.dd-safety,
body.light .velaea-star-box.dd-safety{
  border-color:rgba(124,58,237,.20);
}
html[data-theme="light"] .velaea-star-box.strategy-safety,
body.light .velaea-star-box.strategy-safety{
  border-color:rgba(14,116,144,.18);
}
html[data-theme="light"] .velaea-score-rule.dd-rule summary,
body.light .velaea-score-rule.dd-rule summary{
  color:#6d28d9;
}
html[data-theme="light"] .velaea-score-rule.strategy-rule summary,
body.light .velaea-score-rule.strategy-rule summary{
  color:#0e7490;
}
@media(max-width:900px){
  .velaea-star-strip.three-scores{
    grid-template-columns:1fr;
  }
}


/* =========================================================
   Verified Backtest stamp for dashboard backtest cards - 2026-07-04
   ========================================================= */
.velaea-verified-backtest-stamp{
  display:block;
  height:auto;
  object-fit:contain;
  user-select:none;
  pointer-events:none;
  filter:drop-shadow(0 8px 16px rgba(0,0,0,.34)) drop-shadow(0 0 10px rgba(242,199,106,.18));
}
.dashboard-backtest-note-with-stamp,
.mt5-backtest-hint-with-stamp{
  display:flex!important;
  align-items:center!important;
  justify-content:space-between!important;
  gap:10px!important;
}
.dashboard-backtest-note-with-stamp span,
.mt5-backtest-hint-with-stamp span:first-child{
  min-width:0;
}
.dashboard-history-stamp{
  width:clamp(94px,16%,138px);
  max-width:38%;
  flex:0 0 auto;
  opacity:.96;
}
.dashboard-switcher-stamp{
  width:clamp(86px,18%,126px);
  max-width:36%;
  flex:0 0 auto;
  opacity:.96;
  margin-left:auto;
}
body.light-mode .velaea-verified-backtest-stamp,
html[data-theme="light"] body .velaea-verified-backtest-stamp{
  filter:drop-shadow(0 8px 14px rgba(15,23,42,.14)) drop-shadow(0 0 8px rgba(200,149,46,.16));
}
@media(max-width:720px){
  .dashboard-backtest-note-with-stamp,
  .mt5-backtest-hint-with-stamp{align-items:flex-start!important;}
  .dashboard-history-stamp{width:116px;max-width:46%;}
  .dashboard-switcher-stamp{width:108px;max-width:44%;}
}
@media(max-width:520px){
  .dashboard-backtest-note-with-stamp,
  .mt5-backtest-hint-with-stamp{display:grid!important;grid-template-columns:1fr;justify-items:start!important;}
  .dashboard-history-stamp,
  .dashboard-switcher-stamp{margin-left:0;width:112px;max-width:58%;}
}

/* Dashboard selected Backtest Analytics stamp */
.dashboard-analytics-verified-stamp-host{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  width:100%;
  box-sizing:border-box;
  margin-top:8px;
  padding:2px 14px 6px 0;
  min-height:34px;
  overflow:hidden;
}
.dashboard-analytics-stamp{
  display:block;
  width:clamp(92px,14%,128px);
  max-width:34%;
  margin-left:auto;
  opacity:.95;
  filter:drop-shadow(0 4px 10px rgba(0,0,0,.22)) drop-shadow(0 0 6px rgba(242,199,106,.10));
}
@media(max-width:520px){
  .dashboard-analytics-verified-stamp-host{
    justify-content:flex-start;
    padding:4px 0 6px;
  }
  .dashboard-analytics-stamp{width:112px;max-width:52%;margin-left:0;}
}


/* =========================================================
   Mobile-only polish: Backtest / Portfolio Performance Analytics header
   Scope: #mt5-performance only, so desktop and other areas are untouched.
   ========================================================= */
@media(max-width:520px){
  #mt5-performance.mt5-analytics-panel{
    margin-top:14px!important;
    border-radius:18px!important;
  }

  #mt5-performance.mt5-analytics-panel > .panel-pad{
    padding:14px!important;
  }

  #mt5-performance .panel-head,
  #mt5-performance .panel-head.vsg-inline-host{
    display:grid!important;
    grid-template-columns:1fr!important;
    align-items:start!important;
    justify-content:stretch!important;
    gap:10px!important;
    margin-bottom:14px!important;
  }

  #mt5-performance .panel-head > div:first-child{
    min-width:0!important;
    width:100%!important;
    display:block!important;
  }

  #mt5-performance #mt5AnalyticsTitle{
    margin:0!important;
    max-width:100%!important;
    font-size:clamp(20px,5.6vw,23px)!important;
    line-height:1.12!important;
    letter-spacing:-.025em!important;
    overflow-wrap:anywhere!important;
    word-break:normal!important;
  }

  #mt5-performance #mt5AnalyticsSubtitle{
    display:block!important;
    margin:6px 0 0!important;
    max-width:100%!important;
    color:var(--muted)!important;
    font-size:11.2px!important;
    line-height:1.55!important;
    font-weight:800!important;
    overflow-wrap:anywhere!important;
  }

  #mt5-performance #mt5AnalyticsStatus.mt5-analytics-status{
    order:2!important;
    width:100%!important;
    max-width:100%!important;
    min-height:30px!important;
    justify-content:flex-start!important;
    text-align:left!important;
    white-space:normal!important;
    overflow:visible!important;
    text-overflow:clip!important;
    padding:7px 10px!important;
    border-radius:14px!important;
    font-size:10.5px!important;
    line-height:1.35!important;
  }

  #mt5-performance .vsg-inline-actions{
    order:3!important;
    width:100%!important;
    margin-left:0!important;
    justify-content:stretch!important;
  }

  #mt5-performance .vsg-inline-btn{
    width:100%!important;
    min-height:38px!important;
    justify-content:flex-start!important;
    padding:7px 10px!important;
    border-radius:14px!important;
  }

  #mt5-performance .vsg-inline-btn i{
    width:24px!important;
    height:24px!important;
    min-width:24px!important;
  }

  #mt5-performance .vsg-inline-btn span{
    min-width:0!important;
  }

  #mt5-performance .vsg-inline-btn small{
    font-size:9px!important;
    letter-spacing:.08em!important;
  }

  #mt5-performance .vsg-inline-btn b{
    font-size:12px!important;
    line-height:1.1!important;
  }

  #mt5-performance .mt5-analytics-summary,
  #mt5-performance .mt5-performance-summary{
    grid-template-columns:1fr!important;
    gap:10px!important;
    margin-bottom:14px!important;
  }

  #mt5-performance .mt5-analytics-card{
    min-width:0!important;
    border-radius:16px!important;
    padding:15px 14px 14px!important;
  }

  #mt5-performance .mt5-analytics-card label{
    margin-bottom:8px!important;
    font-size:10.5px!important;
    letter-spacing:.075em!important;
  }

  #mt5-performance .mt5-analytics-card strong{
    max-width:100%!important;
    font-size:clamp(24px,8vw,30px)!important;
    line-height:1.04!important;
    overflow-wrap:anywhere!important;
    word-break:break-word!important;
  }

  #mt5-performance .mt5-analytics-card small{
    margin-top:7px!important;
    max-width:100%!important;
    font-size:11.2px!important;
    line-height:1.45!important;
    overflow-wrap:anywhere!important;
  }

  #mt5-performance .mt5-chart-grid{
    grid-template-columns:1fr!important;
    gap:12px!important;
  }

  #mt5-performance .mt5-chart-box{
    border-radius:18px!important;
  }

  #mt5-performance .mt5-chart-box-head{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:8px!important;
    padding:14px!important;
  }

  #mt5-performance .mt5-chart-box-head strong{
    font-size:17px!important;
    line-height:1.2!important;
    overflow-wrap:anywhere!important;
  }

  #mt5-performance .mt5-chart-box-head span{
    font-size:10.5px!important;
    line-height:1.45!important;
    overflow-wrap:anywhere!important;
  }

  #mt5-performance .mt5-chart-legend{
    justify-content:flex-start!important;
  }

  #mt5-performance .mt5-svg-chart,
  #mt5-performance .mt5-chart-empty{
    height:235px!important;
    min-height:235px!important;
  }
}


/* =========================================================
   Mobile-only polish: graph + Verified Backtest stamp proportion
   Scope: #mt5-performance only. Desktop/tablet unaffected.
   ========================================================= */
@media(max-width:520px){
  #mt5-performance .mt5-chart-grid{
    gap:14px!important;
    margin-bottom:14px!important;
  }

  #mt5-performance .mt5-chart-box{
    border-radius:20px!important;
    overflow:hidden!important;
  }

  /* Balance / Equity chart: reserve elegant lower space for the stamp */
  #mt5-performance #mt5EquityCurveChart.mt5-svg-chart{
    height:260px!important;
    min-height:260px!important;
    padding:10px 10px 42px!important;
  }

  #mt5-performance #mt5EquityCurveChart.mt5-svg-chart svg{
    min-height:0!important;
    height:100%!important;
  }

  /* Turn the stamp into a small professional watermark badge inside the graph box */
  #mt5-performance .mt5-chart-box .dashboard-analytics-verified-stamp-host{
    position:absolute!important;
    right:12px!important;
    bottom:10px!important;
    z-index:8!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    width:auto!important;
    min-height:0!important;
    margin:0!important;
    padding:4px 5px!important;
    border:1px solid rgba(242,199,106,.22)!important;
    border-radius:12px!important;
    background:
      linear-gradient(135deg,rgba(7,18,32,.70),rgba(7,18,32,.36)),
      rgba(4,12,23,.62)!important;
    box-shadow:0 10px 24px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.06)!important;
    backdrop-filter:blur(6px)!important;
    -webkit-backdrop-filter:blur(6px)!important;
    overflow:visible!important;
    pointer-events:none!important;
  }

  #mt5-performance .mt5-chart-box .dashboard-analytics-stamp{
    display:block!important;
    width:84px!important;
    max-width:none!important;
    min-width:0!important;
    height:auto!important;
    margin:0!important;
    opacity:.96!important;
    filter:drop-shadow(0 3px 7px rgba(0,0,0,.28)) drop-shadow(0 0 5px rgba(242,199,106,.10))!important;
  }

  /* Donut / trade distribution: keep proportion balanced on phone */
  #mt5-performance #mt5AllocationChart.mt5-svg-chart{
    height:auto!important;
    min-height:0!important;
    padding:12px 10px 14px!important;
  }

  #mt5-performance #mt5AllocationChart .mt5-allocation-widget{
    grid-template-columns:1fr!important;
    gap:12px!important;
    align-items:center!important;
    min-height:0!important;
    padding:8px!important;
  }

  #mt5-performance #mt5AllocationChart .mt5-allocation-donut{
    width:min(180px,64vw)!important;
    margin:0 auto 2px!important;
  }

  #mt5-performance #mt5AllocationChart .mt5-allocation-donut strong{
    font-size:28px!important;
  }

  #mt5-performance #mt5AllocationChart .mt5-allocation-donut span{
    font-size:10.5px!important;
  }

  #mt5-performance #mt5AllocationChart .mt5-allocation-legend{
    width:100%!important;
    gap:7px!important;
  }

  #mt5-performance #mt5AllocationChart .mt5-allocation-legend div{
    min-width:0!important;
    padding:8px 9px!important;
    border-radius:12px!important;
  }
}

@media(max-width:380px){
  #mt5-performance #mt5EquityCurveChart.mt5-svg-chart{
    height:246px!important;
    min-height:246px!important;
    padding-bottom:40px!important;
  }

  #mt5-performance .mt5-chart-box .dashboard-analytics-stamp{
    width:76px!important;
  }

  #mt5-performance #mt5AllocationChart .mt5-allocation-donut{
    width:min(164px,62vw)!important;
  }
}


/* =========================================================
   Mobile-only: make Balance / Equity chart visually fuller
   Scope: #mt5-performance only. Desktop/tablet unaffected.
   ========================================================= */
@media(max-width:520px){
  #mt5-performance #mt5EquityCurveChart.mt5-svg-chart{
    height:304px!important;
    min-height:304px!important;
    padding:4px 2px 42px!important;
  }

  #mt5-performance #mt5EquityCurveChart.mt5-svg-chart svg{
    width:108%!important;
    height:108%!important;
    max-width:none!important;
    transform:translate(-4%, -2%) scale(1.035)!important;
    transform-origin:center center!important;
  }

  #mt5-performance #mt5EquityCurveChart .mt5-chart-line-balance,
  #mt5-performance #mt5EquityCurveChart .mt5-chart-line-equity{
    stroke-width:3.55!important;
  }

  #mt5-performance #mt5EquityCurveChart .mt5-chart-area-balance,
  #mt5-performance #mt5EquityCurveChart .mt5-chart-area-equity{
    opacity:.52!important;
  }

  #mt5-performance .mt5-chart-box .dashboard-analytics-verified-stamp-host{
    right:10px!important;
    bottom:9px!important;
  }

  #mt5-performance .mt5-chart-box .dashboard-analytics-stamp{
    width:80px!important;
  }
}

@media(max-width:380px){
  #mt5-performance #mt5EquityCurveChart.mt5-svg-chart{
    height:288px!important;
    min-height:288px!important;
    padding:4px 2px 40px!important;
  }

  #mt5-performance #mt5EquityCurveChart.mt5-svg-chart svg{
    width:110%!important;
    height:110%!important;
    transform:translate(-5%, -3%) scale(1.035)!important;
  }

  #mt5-performance .mt5-chart-box .dashboard-analytics-stamp{
    width:72px!important;
  }
}


/* =========================================================
   Dashboard mobile-only: restore previous graph proportion, add height only
   Scope: dashboard page only (not .portfolio-page), #mt5-performance only.
   ========================================================= */
@media(max-width:520px){
  body:not(.portfolio-page) #mt5-performance #mt5EquityCurveChart.mt5-svg-chart{
    height:296px!important;
    min-height:296px!important;
    padding:8px 10px 42px!important;
  }

  body:not(.portfolio-page) #mt5-performance #mt5EquityCurveChart.mt5-svg-chart svg{
    width:100%!important;
    height:100%!important;
    max-width:100%!important;
    transform:none!important;
    transform-origin:center center!important;
  }

  body:not(.portfolio-page) #mt5-performance #mt5EquityCurveChart .mt5-chart-line-balance,
  body:not(.portfolio-page) #mt5-performance #mt5EquityCurveChart .mt5-chart-line-equity{
    stroke-width:3.25!important;
  }

  body:not(.portfolio-page) #mt5-performance #mt5EquityCurveChart .mt5-chart-area-balance,
  body:not(.portfolio-page) #mt5-performance #mt5EquityCurveChart .mt5-chart-area-equity{
    opacity:initial!important;
  }

  body:not(.portfolio-page) #mt5-performance .mt5-chart-box .dashboard-analytics-verified-stamp-host{
    right:12px!important;
    bottom:10px!important;
  }

  body:not(.portfolio-page) #mt5-performance .mt5-chart-box .dashboard-analytics-stamp{
    width:84px!important;
  }
}

@media(max-width:380px){
  body:not(.portfolio-page) #mt5-performance #mt5EquityCurveChart.mt5-svg-chart{
    height:280px!important;
    min-height:280px!important;
    padding:8px 10px 40px!important;
  }

  body:not(.portfolio-page) #mt5-performance #mt5EquityCurveChart.mt5-svg-chart svg{
    width:100%!important;
    height:100%!important;
    max-width:100%!important;
    transform:none!important;
  }

  body:not(.portfolio-page) #mt5-performance .mt5-chart-box .dashboard-analytics-stamp{
    width:76px!important;
  }
}


/* =========================================================
   Dashboard mobile-only: compact Balance / Equity chart block
   Goal: move chart upward near Drawdown Safety, shrink the wrapper
   Scope: dashboard page only, #mt5-performance only.
   ========================================================= */
@media(max-width:520px){
  body:not(.portfolio-page) #mt5-performance .mt5-chart-grid{
    gap:12px!important;
    margin-top:8px!important;
    margin-bottom:12px!important;
  }

  body:not(.portfolio-page) #mt5-performance .mt5-chart-box:first-child{
    border-radius:18px!important;
  }

  body:not(.portfolio-page) #mt5-performance .mt5-chart-box:first-child .mt5-chart-box-head{
    padding:12px 12px 9px!important;
    gap:6px!important;
  }

  body:not(.portfolio-page) #mt5-performance .mt5-chart-box:first-child .velaea-star-rating-host{
    margin:8px 10px 0!important;
  }

  body:not(.portfolio-page) #mt5-performance .mt5-chart-box:first-child .velaea-star-strip,
  body:not(.portfolio-page) #mt5-performance .mt5-chart-box:first-child .velaea-star-strip.three-scores{
    gap:7px!important;
    margin:0!important;
  }

  body:not(.portfolio-page) #mt5-performance .mt5-chart-box:first-child .velaea-star-box{
    padding:8px 9px!important;
    border-radius:12px!important;
    min-height:0!important;
  }

  body:not(.portfolio-page) #mt5-performance .mt5-chart-box:first-child .velaea-star-box .star-title{
    font-size:8.8px!important;
    line-height:1.1!important;
    margin-bottom:4px!important;
  }

  body:not(.portfolio-page) #mt5-performance .mt5-chart-box:first-child .velaea-star-set{
    gap:1px!important;
  }

  body:not(.portfolio-page) #mt5-performance .mt5-chart-box:first-child .velaea-star-set i{
    font-size:10px!important;
    line-height:1!important;
  }

  body:not(.portfolio-page) #mt5-performance .mt5-chart-box:first-child .velaea-star-box b{
    font-size:10.5px!important;
    line-height:1.05!important;
  }

  body:not(.portfolio-page) #mt5-performance .mt5-chart-box:first-child .velaea-star-box small{
    font-size:8.4px!important;
    line-height:1.25!important;
    margin-top:3px!important;
  }

  body:not(.portfolio-page) #mt5-performance .mt5-chart-box:first-child .velaea-score-rule{
    margin-top:4px!important;
    padding-top:4px!important;
  }

  body:not(.portfolio-page) #mt5-performance .mt5-chart-box:first-child .velaea-score-rule summary{
    font-size:8.4px!important;
    line-height:1.2!important;
  }

  body:not(.portfolio-page) #mt5-performance #mt5EquityCurveChart.mt5-svg-chart{
    margin-top:-10px!important;
    height:268px!important;
    min-height:268px!important;
    padding:0 10px 36px!important;
  }

  body:not(.portfolio-page) #mt5-performance #mt5EquityCurveChart.mt5-svg-chart svg{
    width:100%!important;
    height:100%!important;
    max-width:100%!important;
    transform:none!important;
  }

  body:not(.portfolio-page) #mt5-performance .mt5-chart-box .dashboard-analytics-verified-stamp-host{
    right:11px!important;
    bottom:8px!important;
    padding:3px 4px!important;
    border-radius:11px!important;
  }

  body:not(.portfolio-page) #mt5-performance .mt5-chart-box .dashboard-analytics-stamp{
    width:78px!important;
  }

  body:not(.portfolio-page) #mt5-performance #mt5AllocationChart.mt5-svg-chart{
    padding-top:10px!important;
  }
}

@media(max-width:380px){
  body:not(.portfolio-page) #mt5-performance .mt5-chart-box:first-child .velaea-star-rating-host{
    margin:7px 9px 0!important;
  }

  body:not(.portfolio-page) #mt5-performance #mt5EquityCurveChart.mt5-svg-chart{
    margin-top:-12px!important;
    height:256px!important;
    min-height:256px!important;
    padding:0 9px 34px!important;
  }

  body:not(.portfolio-page) #mt5-performance .mt5-chart-box .dashboard-analytics-stamp{
    width:72px!important;
  }
}
