/* VYRO UI 8.7.4: explicit chart / flow+SMC / lower controls grid.
   Loaded last. All overrides are scoped; no data or signal styles are rewritten. */
html body.vyroLayout874 {
  --vyro-rail-width: 306px;
  --vyro-chart-height: clamp(440px, 58vh, 650px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  min-width: 0;
  max-width: 100%;
}
html body.vyroLayout874 .main.vyroWorkspace874 {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) var(--vyro-rail-width) !important;
  grid-template-rows: auto auto !important;
  gap: 10px !important;
  align-items: start !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin: 0 16px 20px !important;
  padding: 0 !important;
  overflow: visible !important;
}
html body.vyroLayout874 .main.vyroWorkspace874 > .chartCard {
  grid-column: 1 !important;
  grid-row: 1 !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 10px !important;
  align-self: start !important;
  overflow: hidden !important;
}
html body.vyroLayout874 .main.vyroWorkspace874 > #vyroMtfRightRail {
  grid-column: 2 !important;
  grid-row: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  position: relative !important;
  inset: auto !important;
  align-self: start !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: none !important;
  overflow: visible !important;
}
html body.vyroLayout874 #vyroMtfRightRail > .panel {
  flex: 0 0 auto !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  margin: 0 !important;
  padding: 10px !important;
  border: 1px solid var(--line) !important;
  border-radius: 13px !important;
  background: var(--card) !important;
}
html body.vyroLayout874 #vyroMtfRightRail .panel h3 {
  position: static !important;
  font-size: 13px !important;
  line-height: 1.45 !important;
  margin: 0 0 7px !important;
  padding: 0 !important;
  overflow-wrap: anywhere;
}
html body.vyroLayout874 #vyroMtfRightRail .mtfSummary {
  padding: 6px 7px !important;
  margin-bottom: 6px !important;
  font-size: 10px !important;
  line-height: 1.4 !important;
}
html body.vyroLayout874 #vyroMtfRightRail .mtfSummary b { font-size: 15px !important; }
html body.vyroLayout874 #vyroMtfRightRail .mtfDetail {
  padding: 7px !important;
  margin: 0 0 6px !important;
}
html body.vyroLayout874 #vyroMtfRightRail .mtfDetail:last-child { margin-bottom: 0 !important; }
html body.vyroLayout874 #vyroMtfRightRail .mtfTop { font-size: 12px !important; margin-bottom: 5px !important; }
html body.vyroLayout874 #vyroMtfRightRail .mtfNums { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 4px !important; font-size: 9px !important; }
html body.vyroLayout874 #vyroMtfRightRail .mtfNums span { padding: 4px 2px !important; min-width: 0 !important; }
html body.vyroLayout874 #vyroMtfRightRail .mtfNums b { font-size: 11px !important; overflow-wrap: anywhere; }
html body.vyroLayout874 #vyroMtfRightRail .mtfMini { font-size: 10px !important; line-height: 1.35 !important; margin-top: 4px !important; }
html body.vyroLayout874 #vyroSmcProPanel .row { padding: 5px 0 !important; font-size: 11px !important; line-height: 1.35 !important; }
html body.vyroLayout874 #vyroSmcProPanel .row b { font-size: 11px !important; overflow-wrap: anywhere; }
html body.vyroLayout874 #vyroChartBelow874 {
  grid-column: 1 / -1 !important;
  grid-row: 2 !important;
  min-width: 0 !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}
html body.vyroLayout874 #vyroChartBelow874 > * { max-width: 100%; min-width: 0; }
html body.vyroLayout874 #chart {
  position: relative !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: var(--vyro-chart-height) !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}
/* Compact header without throwing away any controls. */
html body.vyroLayout874 .chartCard .chartHead {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px 8px !important;
  align-items: center !important;
  margin-bottom: 6px !important;
}
html body.vyroLayout874 .chartCard .chartTopDock { gap: 5px !important; }
html body.vyroLayout874 .chartCard .chartTfLabel { display: none !important; }
html body.vyroLayout874 .chartCard .chartTfDock { flex-wrap: nowrap !important; gap: 4px !important; }
html body.vyroLayout874 .chartCard .chartTfDock .pill.tf {
  min-width: 34px !important; min-height: 30px !important; padding: 5px 8px !important; font-size: 11px !important;
}
html body.vyroLayout874 .chartCard .chartActions {
  width: 100% !important; display: flex !important; flex-wrap: nowrap !important;
  gap: 4px !important; justify-content: flex-end !important; overflow-x: auto !important; min-width: 0 !important;
}
html body.vyroLayout874 .chartCard .chartActions > * { flex-shrink: 0; }
html body.vyroLayout874 .chartCard .chartActions .ct { font-size: 10px !important; }
html body.vyroLayout874 .chartCard .chartActions button {
  min-width: 30px !important; min-height: 28px !important; height: auto !important; padding: 4px 7px !important; font-size: 10px !important;
}
html body.vyroLayout874 .chartCard .vyroClassroomBar {
  display: flex !important; flex-wrap: nowrap !important; gap: 4px !important;
  width: 100% !important; min-width: 0 !important; max-width: 100% !important;
  margin: 3px 0 6px !important; padding: 4px !important; overflow-x: auto !important; overflow-y: hidden !important;
}
html body.vyroLayout874 .chartCard .vyroClassroomBar > * { flex-shrink: 0 !important; }
html body.vyroLayout874 .chartCard .vyroClassroomBar button {
  min-height: 28px !important; height: auto !important; padding: 4px 7px !important; font-size: 10px !important;
}
/* Vietnamese stays in UTF-8; use installed system fonts, no remote font dependency. */
html body.vyroLayout874 #vyroViewToolbar,
html body.vyroLayout874 #vyroAnalysisDrawer,
html body.vyroLayout874 #vyroMtfRightRail {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;
}
html body.vyroLayout874 #vyroViewToolbar {
  display: flex !important; flex-wrap: wrap !important; gap: 6px 10px !important;
  margin: 0 16px 8px !important; padding: 6px 9px !important; max-width: 100% !important;
}
html body.vyroLayout874 #vyroViewToolbar button { width: auto !important; flex: 0 1 auto !important; padding: 7px 10px !important; font-size: 11px !important; }
html body.vyroLayout874 #vyroViewToolbar span { font-size: 11px !important; }
html body.vyroLayout874 .vyroUiVersion874 { margin-left: auto; color: var(--muted); font-size: 10px; white-space: nowrap; }
html body.vyroLayout874 #vyroAnalysisDrawer { display: block !important; max-height: none !important; overflow: visible !important; transition: none !important; }
html body.vyroLayout874 #vyroAnalysisDrawer.collapsed { display: none !important; }
html body.vyroLayout874 #vyroAnalysisDrawer .vyroExtraPanels { align-items: start !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
html body.vyroLayout874 #vyroAiControlPanel,
html body.vyroLayout874 .aiDeepseekPanel { min-width: 0 !important; width: 100% !important; max-width: 100% !important; }
html body.vyroLayout874 #vyroAiControlPanel > #vyroIntelInSmc {
  margin: 0 0 10px !important; padding: 9px !important; border: 1px solid var(--line) !important;
  border-radius: 10px !important; max-width: 100% !important; overflow-wrap: anywhere;
}
html body.vyroLayout874 #vyroAiControlPanel .intelGrid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
html body.vyroLayout874 #vyroAnalysisDrawer .aiQuickBtns { display: flex !important; flex-wrap: wrap !important; gap: 6px !important; }
html body.vyroLayout874 #vyroAnalysisDrawer .aiQuickBtns button { flex: 1 1 140px !important; min-width: 0 !important; width: auto !important; white-space: normal !important; }
@media (min-width: 1500px) {
  html body.vyroLayout874 { --vyro-rail-width: 320px; }
}
@media (min-width: 740px) and (max-width: 1100px) {
  html body.vyroLayout874 { --vyro-rail-width: 254px; --vyro-chart-height: clamp(420px, 56vh, 660px); }
}
@media (min-width: 740px) and (max-width: 950px) {
  html body.vyroLayout874 .chartCard .chartTitleGroup { width: 100% !important; }
  html body.vyroLayout874 .chartCard .chartTopDock { margin-left: 0 !important; }
  html body.vyroLayout874 .chartCard .chartActions { justify-content: flex-start !important; }
}
@media (max-width: 739px) {
  html body.vyroLayout874 { --vyro-chart-height: clamp(320px, 52vh, 520px); }
  html body.vyroLayout874 .main.vyroWorkspace874 { grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: auto auto auto !important; gap: 7px !important; }
  html body.vyroLayout874 .main.vyroWorkspace874 > #vyroMtfRightRail { grid-column: 1 !important; grid-row: 2 !important; }
  html body.vyroLayout874 #vyroChartBelow874 { grid-column: 1 !important; grid-row: 3 !important; }
  html body.vyroLayout874 .main.vyroWorkspace874 > .chartCard { padding: 6px !important; }
  html body.vyroLayout874 #vyroViewToolbar span { display: none !important; }
  html body.vyroLayout874 #vyroAnalysisDrawer .vyroExtraPanels { grid-template-columns: minmax(0, 1fr) !important; }
  html body.vyroLayout874 .chartCard .chartActions { justify-content: flex-start !important; }
}
/* Fullscreen keeps the original chart node, shows only chart + MTF, and remains reversible. */
html body.vyroLayout874.vyroFs830 .main.vyroWorkspace874 {
  position: fixed !important; inset: 0 !important;
  width: 100% !important; height: 100vh !important; height: 100dvh !important;
  grid-template-columns: minmax(0, 1fr) 260px !important; grid-template-rows: minmax(0, 1fr) !important;
  gap: 3px !important; padding: 3px !important; overflow: hidden !important;
}
html body.vyroLayout874.vyroFs830 .main.vyroWorkspace874 > .chartCard {
  grid-column: 1 !important; grid-row: 1 !important; height: 100% !important; min-height: 0 !important; padding: 0 !important;
}
html body.vyroLayout874.vyroFs830 #chart { position: absolute !important; inset: 0 !important; height: 100% !important; min-height: 0 !important; }
html body.vyroLayout874.vyroFs830 #vyroChartBelow874 { display: none !important; }
html body.vyroLayout874.vyroFs830 .main.vyroWorkspace874 > #vyroMtfRightRail {
  grid-column: 2 !important; grid-row: 1 !important; height: 100% !important; min-height: 0 !important;
  overflow: hidden !important; display: block !important;
}
html body.vyroLayout874.vyroFs830 #vyroMtfRightRail > .panel { display: none !important; }
html body.vyroLayout874.vyroFs830 #vyroMtfRightRail > #vyroMtfFlowPanel.vyroFsFlow830 {
  display: block !important; height: 100% !important; max-height: 100% !important; overflow-y: auto !important; padding: 7px !important;
}
html body.vyroLayout874.vyroFs830 #vyroViewToolbar,
html body.vyroLayout874.vyroFs830 #vyroAnalysisDrawer { display: none !important; }
@media (max-width: 900px) and (orientation: landscape) {
  html body.vyroLayout874.vyroFs830 .main.vyroWorkspace874 { grid-template-columns: minmax(0, 1fr) 180px !important; }
}
@media (max-width: 739px) and (orientation: portrait) {
  html body.vyroLayout874.vyroFs830 .main.vyroWorkspace874 { grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: minmax(0, 1fr) 30vh !important; grid-template-rows: minmax(0, 1fr) 30dvh !important; }
  html body.vyroLayout874.vyroFs830 .main.vyroWorkspace874 > #vyroMtfRightRail { grid-column: 1 !important; grid-row: 2 !important; }
}

/* Dock the legacy EMA status card instead of letting it cover live MTF values. */
html body.vyroLayout874 #vyroChartBelow874 > #v1111EmaPanel {
  position: relative !important; inset: auto !important; transform: none !important;
  width: 100% !important; max-width: 100% !important; margin: 10px 0 0 !important;
  z-index: auto !important; backdrop-filter: none !important;
}

@media (max-width: 900px) {
  html body.vyroLayout874 .main.vyroWorkspace874 { margin: 0 0 12px !important; }
  html body.vyroLayout874 #vyroViewToolbar { margin: 0 0 8px !important; }
}
html body.vyroLayout874.vyroFs830 .main.vyroWorkspace874 { margin: 0 !important; }
