/* intraday-ws.css — trang "Giao dịch trong ngày" BỐ CỤC 1 TRANG kiểu trang Phái sinh (30/10/2026), đi cùng intraday-ws.js.
   Nạp SAU intraday-flow.css; chỉ có hiệu lực khi #ifl-root có class .iws (intraday-ws.js gắn khi dựng lưới).
   Dùng bộ thiết kế của trang Phái sinh (derivatives.css): màu nền panel/panel2/line/grid, dải tab .gtabs, nút nhóm .seg,
   ô chọn bo tròn, ô số liệu .cards, biểu tượng ⓘ + hộp chú giải .tipbox. Finalyze chỉ còn giao diện tối. */

.iws {
  --panel: #111f27; --panel2: #152731; --line: #1d3a45; --grid: #16303a; --text: #e8f4f5; --muted: #92b6bd;
  --accent: #05f0dd; --btn: #152731; --btn-on: #017884; --btn-on-text: #fff; --shadow: 0 3px 14px rgba(0, 0, 0, .3);
  --card: var(--panel); --ink: var(--text); --ifl-soft: var(--panel2); --ifl-grid: var(--grid);
  font-size: 13px;
}

/* ---------- nút nhóm (.seg), ô chọn bo tròn, nút biểu tượng ---------- */
.iws .ifl-seg { display: inline-flex; padding: 0; gap: 0; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: var(--btn); max-width: 100%; }
.iws .ifl-seg button, .iws .ifl-seg-sm button {
  min-height: 0; height: 26px; padding: 0 10px; border: 0; border-radius: 0; background: var(--btn); color: var(--text);
  font: 700 11.5px Manrope; box-shadow: none;
}
.iws .ifl-seg button + button { border-left: 1px solid var(--line); }
.iws .ifl-seg button:hover { background: color-mix(in srgb, var(--btn) 80%, var(--accent) 20%); }
.iws .ifl-seg button[aria-checked="true"] { background: var(--btn-on); color: var(--btn-on-text); box-shadow: none; }
.iws select, .iws .ifl-picker select, .iws .ifl-filters select, .iws .ifl-custom select {
  height: 28px; min-height: 0; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel2);
  color: var(--text); font: 600 12px Manrope;
}
.iws .ifl-filters .ifl-cb-btn { min-height: 0; height: 28px; padding: 0 12px; border-radius: 999px; background: var(--panel2); font-size: 12px; }
.iws .ifl-cb-pop, .iws .ifl-cb-list { background: var(--panel); }
.iws .ifl-dir { min-width: 28px; min-height: 0; height: 28px; border-radius: 999px; background: var(--panel2); font-size: 13px; }
.iws .ifl-ct { gap: 2px; }
.iws .ifl-ct button { width: 28px; height: 28px; min-height: 0; padding: 0; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); font-size: 15px; }
.iws .ifl-ct button:hover { background: var(--panel2); color: var(--text); }
.iws .ifl-more { min-height: 0; height: 30px; margin: 8px auto 0; width: auto; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--btn); color: var(--text); font: 700 12px Manrope; }
.iws .ifl-more:hover { border-color: var(--accent); background: var(--btn); }

/* ---------- đầu trang: 1 khung gồm thanh chọn phiên (trạng thái bên phải) + hàng ô số liệu ---------- */
.iws .iws-top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--line); border-bottom: 1px solid var(--grid); border-radius: 12px 12px 0 0;
}
.iws .iws-top > .ifl-picker { margin: 0; gap: 8px 12px; flex: 1 1 520px; min-width: 0; }
.iws .ifl-picker .ifl-count { flex: 0 1 auto; font-size: 12px; }
.iws .ifl-custom label { font-size: 12px; }
.iws .iws-subnote { flex: 0 1 auto; color: #f1c617; font-size: 11.5px; font-weight: 600; }
/* trạng thái gọn kiểu "live-note": chấm + nhãn + chi tiết, không khung */
.iws .iws-top > .ifl-status { flex: 0 1 auto; min-height: 0; padding: 0; border: 0; background: transparent; gap: 7px; margin-left: auto; }
.iws .ifl-status .ifl-status-label { font-size: 12px; }
.iws .ifl-status .ifl-status-detail { font-size: 11.5px; }
.iws .ifl-status .ifl-dot { width: 8px; height: 8px; }
.iws .ifl-kpis {
  grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin: 0 0 12px; padding: 8px 10px 10px;
  background: var(--panel); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px;
}
.iws .ifl-kpi { gap: 1px; padding: 6px 10px; background: var(--panel2); border: 0; border-radius: 8px; }
.iws .ifl-kpi h3 { font: 600 10.5px Manrope; letter-spacing: 0; }
.iws .ifl-kpi-v { font: 700 16px/1.3 Manrope; letter-spacing: 0; }
.iws .ifl-kpi-v-sm { font-size: 13px; }
.iws .ifl-kpi-s { font-size: 11px; font-weight: 600; }
.iws .ifl-kpi .ifl-ratio { height: 6px; margin: 4px 0 0; border: 0; }
.iws > .ifl-notice { margin-bottom: 12px; border-radius: 10px; }

/* ---------- lưới 3 cột: Dòng tiền lớn ~40% / Khối ngoại ~34% / Sự kiện + Lệnh lặp ~26%, cửa sổ kiểu .grp của trang Phái sinh ---------- */
.iws-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr) minmax(0, .92fr); gap: 10px; align-items: stretch; }
.iws-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }
.iws-grp {
  display: flex; flex-direction: column; flex: var(--f, 1) 1 0; min-height: 0; min-width: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; container-type: inline-size;
}
/* dải tab (.gtabs): luôn 1 hàng; tab không chọn co lại, cắt chữ "…" */
.iws-tabs { display: flex; flex: 0 0 auto; gap: 1px; background: var(--panel2); border-bottom: 1px solid var(--line); overflow: hidden; border-radius: 11px 11px 0 0; }
.iws-tab { display: flex; align-items: center; min-width: 0; flex: 0 1 auto; border-bottom: 2px solid transparent; }
.iws-tab.on { flex-shrink: 0; background: var(--panel); border-bottom-color: var(--accent); }
.iws-tb {
  min-width: 0; height: 32px; padding: 0 10px; border: 0; background: transparent; cursor: pointer;
  color: var(--muted); font: 700 12px Manrope; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.iws-tb:hover { color: var(--text); }
.iws-tab.on .iws-tb { color: var(--text); padding-right: 0; }
/* ⓘ cạnh tên tab đang chọn (.info) */
.iws-i {
  display: none; place-items: center; flex: none; width: 18px; height: 18px; margin: 0 6px 0 4px; padding: 0; cursor: pointer;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted); font: 12px/1 Manrope;
}
.iws-tab.on .iws-i { display: inline-grid; }
.iws-i:hover, .iws-i:focus-visible, .iws-i[aria-expanded="true"] { color: var(--text); background: var(--panel2); outline: none; }
.iws-body { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; position: relative; }
.iws-pane { flex: 1 0 auto; display: flex; flex-direction: column; min-width: 0; }
.iws-pane.iws-fill { flex: 1 1 0; min-height: 0; }
.iws-empty { margin: auto; font-size: 12.5px; }

/* thẻ cũ nằm trong cửa sổ: bỏ khung riêng; tên thẻ đã ở tab nên ẩn tiêu đề lớn; đầu thẻ thành thanh điều khiển (.pn-bar) */
.iws-pane > .ifl-card, .iws-pane > section { margin: 0; border: 0; border-radius: 0; background: transparent; padding: 0 10px 10px; flex: 1 0 auto; min-width: 0; box-shadow: none; }
.iws-pane.iws-fill > .ifl-card { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.iws-pane > .ifl-notice { margin: 8px 10px 0; padding: 7px 10px; font-size: 12px; border-radius: 8px; }
.iws #ifl-chart-title, .iws #ifl-chart2-title, .iws #ifl-f-chart-title, .iws #ifl-bst-title, .iws #ifl-ev-title, .iws #ifl-r-title, .iws #ifl-f-rc-title { display: none; }
.iws .ifl-card-head { margin: 0 -10px 8px; padding: 7px 10px; gap: 6px 10px; align-items: center; border-bottom: 1px solid var(--grid); }
.iws .ifl-card-sub { margin-top: 0; font-size: 11.5px; }
/* điều khiển biểu đồ Mua/bán chủ động nằm trên dải tab, bên phải (user 30/10): 2 ô chọn + 4 nút công cụ, không xuống dòng */
.iws .iws-tabs { align-items: center; }
.iws .iws-ctl { display: flex; flex: 0 0 auto; flex-wrap: nowrap; align-items: center; gap: 4px; margin-left: auto; padding: 0 6px; }
.iws .iws-ctl > .ifl-seg { display: none !important; }   /* nhóm nút gốc: ô chọn bấm hộ */
.iws .iws-ctl .iws-sel { height: 24px; max-width: 132px; padding: 0 6px 0 9px; font-size: 11.5px; }
.iws .iws-ctl .ifl-ct { gap: 0; }
/* lớp khoá theo gói (FSIAuth.gate) gắn style="position:relative" lên thẻ -> đè .ifl-fs; toàn màn hình phải thắng */
.iws .ifl-chart-card.ifl-fs { position: fixed !important; }
.iws #ifl-ct-in, .iws #ifl-ct-out, .iws #ifl-ct-reset { display: none; }   /* user 30/10: chỉ giữ nút toàn màn hình (zoom bằng cuộn chuột / phím vẫn dùng được) */
.iws .iws-ctl .ifl-ct button { width: 24px; height: 24px; font-size: 14px; border-radius: 6px; }
.iws-grp[data-act="chart2"] .iws-ctl > .iws-sel:first-child, .iws-grp[data-act="chart2"] .iws-ctl .ifl-ct { display: none; }   /* chỉ áp cho biểu đồ chính */
.iws .ifl-chart-card .ifl-card-head:not(:has(.iws-ctl)):not(:has(.iws-mini)):not(:has(.ifl-card-sub:not(:empty))) { display: none; }
.iws .ifl-chart-card .ifl-card-head > .iws-ctl { margin-left: auto; }   /* toàn màn hình: điều khiển về đầu thẻ */
.iws-fill .ifl-chart-card .ifl-chart-wrap { flex: 1 1 0; height: auto; min-height: 150px; }
.iws .ifl-legend { margin-top: 6px; gap: 4px 14px; font-size: 11px; }
.iws .ifl-pyr-card { padding-top: 8px; }
.iws .ifl-pyr-head h2 { font: 700 12.5px Manrope; }
.iws .ifl-pyr .pyr-row { border-top-color: var(--grid); }
/* hàng tháp mua/bán ròng thấp lại (user 30/10): 38 -> 26 px, chữ 12 px -> cửa sổ hiện được nhiều mã hơn */
.iws .ifl-pyr { margin-top: 4px; }
.iws .ifl-pyr .pyr-half { min-height: 26px; gap: 2px 8px; }
.iws .ifl-pyr .pyr-fill { top: 3px; bottom: 3px; }
.iws .ifl-pyr .rk-sym { font: 700 12.5px Manrope; }
.iws .ifl-pyr .rk-px, .iws .ifl-pyr .rk-pct, .iws .ifl-pyr .rk-net { font-size: 12px; }
.iws .ifl-pyr .rk-i { font-size: 11px; }
.iws #ifl-rk-more, .iws #ifl-sec-more, .iws #ifl-f-more, .iws #ifl-bst-more { display: none !important; }   /* hiện hết sẵn, cuộn trong cửa sổ (user 30/10) */
.iws .ifl-chip { font-size: 10.5px; padding: 2px 7px; border-radius: 4px; }
.iws .ifl-ev, .iws .ifl-rr { border-bottom-color: var(--grid); }
.iws .ifl-ev:hover, .iws .ifl-rr:hover { background: var(--panel2); }
.iws .ifl-ev .ev-sym, .iws .ifl-rr .rr-sym { font: 700 13px Manrope; }
.iws .ifl-bst-h { margin: 10px 0 4px; font-size: 10.5px; }
.iws .ifl-pyr-card.ifl-rc-card .ifl-card-head { justify-content: flex-end; }

/* ô trạng thái nhỏ (Khối ngoại, Lệnh lặp) */
.iws-mini { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-size: 11.5px; color: var(--muted); }
.iws-mini b { color: var(--text); font: 700 12px Manrope; white-space: nowrap; }
.iws-mini span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.iws-mini .ifl-dot { width: 8px; height: 8px; }
.iws-mini[data-state="live"] .ifl-dot { background: var(--green2); box-shadow: 0 0 0 3px rgba(2, 191, 200, .18); }
.iws-mini[data-state="slow"] .ifl-dot, .iws-mini[data-state="lunch"] .ifl-dot,
.iws-mini[data-state="waiting"] .ifl-dot, .iws-mini[data-state="partial"] .ifl-dot { background: var(--amber); }
.iws-mini[data-state="error"] .ifl-dot, .iws-mini[data-state="source_error"] .ifl-dot { background: var(--red); border-radius: 2px; transform: rotate(45deg); }
.iws-mini[data-state="closed"] .ifl-dot, .iws-mini[data-state="holiday"] .ifl-dot { background: transparent; border: 2px solid var(--muted); }
.iws .ifl-card-head > .iws-mini { flex: 1 1 auto; justify-content: flex-end; }

/* ---------- Lệnh lặp trong cửa sổ hẹp (cột 3): bảng dạng 2 dòng ---------- */
.iws #ifl-view-robot { padding: 0 10px 10px; }
.iws #ifl-view-robot > .ifl-picker { margin: 0 -10px; padding: 7px 10px; gap: 6px 8px; border-bottom: 1px solid var(--grid); }
.iws #ifl-view-robot .ifl-lbl:has(#ifl-r-date) { display: none; }
.iws #ifl-view-robot .ifl-picker > .iws-mini { flex: 0 0 100%; }
.iws #ifl-view-robot .ifl-count { display: none; }
.iws #ifl-view-robot .ifl-sortbox { display: inline-flex; gap: 4px; }
.iws #ifl-view-robot .ifl-sortbox .ifl-lbl { gap: 6px; font-size: 11.5px; }
.iws #ifl-view-robot .ifl-r-filters { margin: 8px 0 0; }
.iws #ifl-view-robot .ifl-body { margin-top: 6px; min-height: 0; }
.iws #ifl-r-kpis { display: none; }
.iws #ifl-view-robot .ifl-card { margin: 0; padding: 0; border: 0; background: transparent; }
.iws #ifl-view-robot .ifl-card-head { display: none; }
.iws .ifl-r-table .ifl-thead { display: none; }
.iws .ifl-rr, .iws #ifl-view-robot.has-anom .ifl-rr { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; padding: 8px 4px; min-height: 0; }
.iws .ifl-rr .br { display: block; flex: 0 0 100%; height: 0; order: 5; }
.iws .ifl-rr .rr-sym-c { order: 1; }
.iws .ifl-rr .rr-side-c { order: 2; }
.iws .ifl-rr .rr-st-c { order: 3; }
.iws .ifl-rr .rr-peakn-c { order: 4; margin-left: auto; font-size: 12.5px; }
.iws .ifl-rr .rr-anom-c { order: 4; color: var(--text); font-size: 12.5px; }
.iws .ifl-rr .rr-first-c { order: 6; } .iws .ifl-rr .rr-vol-c { order: 7; } .iws .ifl-rr .rr-val-c { order: 8; }
.iws .ifl-rr .rr-win-c { order: 9; } .iws .ifl-rr .rr-burst-c { order: 10; } .iws .ifl-rr .rr-peakat-c { order: 11; }
.iws .ifl-rr .rr-liq-c { order: 12; margin-left: auto; }
.iws .ifl-rr [data-l]:not(.rr-sym-c):not(.rr-side-c):not(.rr-st-c):not(.rr-liq-c)::before { content: attr(data-l) ' '; color: var(--muted); font-weight: 600; }
.iws .ifl-rr .rr-peakn-c::before { content: attr(data-l) ' ' !important; color: var(--muted); font-weight: 600; font-size: 11.5px; }
.iws .ifl-rr .rr-peakn-c::after { content: ' lệnh/2 phút'; color: var(--muted); font-weight: 600; font-size: 11.5px; }
.iws .ifl-rr [data-l]:not(.rr-sym-c):not(.rr-side-c):not(.rr-st-c):not(.rr-peakn-c):not(.rr-liq-c) { color: var(--muted); font-size: 11.5px; }
.iws .ifl-rr .rr-st-c:not(:has(.ifl-chip)) { display: none; }
.iws .ifl-rr .rr-liq { color: var(--accent); font-size: 11.5px; }

/* bảng sự kiện ở cột 3: thanh lọc gọn ngay dưới tab */
.iws .ifl-ev-card .ifl-filters { margin: 0 -10px 4px; padding: 7px 10px; gap: 6px; border-bottom: 1px solid var(--grid); }
.iws .ifl-ev-card .ifl-filters select { max-width: 150px; }
.iws .ifl-ev-card .ifl-card-head { border-bottom: 0; margin-bottom: 0; padding-bottom: 2px; }
.iws .ifl-r-filters { gap: 6px; }

/* thống kê dồn dập nhiều phiên trong cửa sổ hẹp: 2 dòng (như điện thoại) theo bề rộng thẻ */
@container (max-width: 640px) {
  .iws .bst-rrow { grid-template-columns: minmax(0, 1fr) auto auto; }
  .iws .bst-rrow .bst-who { grid-column: 1 / 3; grid-row: 1; }
  .iws .bst-rrow .bst-gtot { grid-column: 3; grid-row: 1; }
  .iws .bst-rrow .bst-rcnt { grid-column: 1; grid-row: 2; }
  .iws .bst-rrow .bst-rdur { grid-column: 2; grid-row: 2; }
  .iws .bst-rrow .bst-pace { grid-column: 3; grid-row: 2; }
}

/* ---------- hộp chú giải ⓘ (.tipbox) ---------- */
.iws-pop {
  position: fixed; z-index: 1000; overflow-y: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: #0b161c; color: var(--text); box-shadow: 0 12px 32px rgba(0, 0, 0, .45); font: 12.5px/1.55 Manrope, system-ui, sans-serif;
}
.iws-pop-h { display: block; margin-bottom: 6px; font: 700 13px Manrope; }
.iws-pop-b p { margin: 0 0 8px; }
.iws-pop-b p:last-child { margin-bottom: 0; }
.iws-pop-b b { font-weight: 800; }
.iws .ifl-tt { background: #0b161c; border-color: var(--line); }
.iws .ifl-tip { background: #0b161c; border-color: var(--line); }

/* ---------- màn hình hẹp: 1 cột, cửa sổ cao theo nội dung ---------- */
@media (max-width: 1399px) {
  .iws .ifl-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1199px) {
  .iws-grid { grid-template-columns: minmax(0, 1fr); height: auto !important; }
  .iws-col { display: contents; }
  .iws-grp { flex: none; overflow: visible; }
  .iws-body { overflow: visible; }
  .iws-pane.iws-fill, .iws-pane.iws-fill > .ifl-card { flex: none; }
  .iws-fill .ifl-chart-card .ifl-chart-wrap { flex: none; height: 300px; }
  .iws .iws-top > .ifl-status { flex: 1 1 100%; margin-left: 0; }
}
@media (max-width: 640px) {
  .iws .ifl-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .iws .ifl-seg button, .iws .ifl-seg-sm button { height: 30px; }
  .iws-tb { height: 36px; padding: 0 9px; }
  .iws .iws-top > .ifl-picker { flex: 1 1 100%; }
}
