/* ==========================================================================
   NHỊP · V2.6 — GIAO DIỆN GỌN (PC + ĐIỆN THOẠI)
   Lớp ghi đè nạp SAU CÙNG. Không đổi dữ liệu/logic, chỉ đổi cỡ chữ, khoảng cách, bố cục.
   Muốn chỉnh nhanh: sửa các biến ở :root ngay bên dưới.
   ========================================================================== */
:root{
  --c-fs:13px;        /* cỡ chữ nền */
  --c-fs-s:11.5px;    /* chữ phụ */
  --c-top:48px;       /* chiều cao thanh trên */
  --c-pad:12px;       /* đệm trong khung */
  --c-gap:10px;       /* khoảng cách giữa khung */
  --c-rad:12px;       /* bo góc */
  --c-cell-y:6px;     /* đệm dọc ô bảng */
  --c-ctl:32px;       /* chiều cao ô nhập/nút */
}

/* ---------- 1. Nền chữ + sửa lỗi "xuống dòng khắp nơi" ---------- */
html body{font-size:var(--c-fs);line-height:1.4}
#view :is(h1,h2,h3,h4,p,label,small,strong,span,a,td,th,legend){overflow-wrap:normal;word-break:normal}
#view :is(td,th){white-space:nowrap}
#view :is(.table-wrap,.db-table-wrap,.an-bt-table-wrap,.table-responsive,.orders-table-wrap,.watch-table-wrap) table{min-width:0}
#view table{font-size:12.5px}
#view th,#view td,.db-table th,.db-table td,.tbl th,.tbl td{padding:var(--c-cell-y) 8px!important;line-height:1.3}
#view th{font-size:11px;letter-spacing:.02em;font-weight:700;white-space:nowrap}
#view :is(.sg-row,.wl-row,.acc-row,.nd-row,.tr-row,.cu-row,.rs-row){padding-top:5px!important;padding-bottom:5px!important}

/* ---------- 2. Khung, tiêu đề, nút, ô nhập ---------- */
html body .panel{padding:var(--c-pad) calc(var(--c-pad) + 2px)!important;margin-bottom:var(--c-gap);border-radius:var(--c-rad);box-shadow:0 1px 3px #0a1e3212}
html body .panelhead{margin-bottom:8px;gap:8px}
html body .panelhead h2,#view h2{font-size:14.5px;margin:1px 0 0;letter-spacing:-.1px}
.panel-sub,.soft-text,.pfx-lead{font-size:var(--c-fs-s);margin-top:2px}
.eyebrow,.side-label{font-size:9.5px;letter-spacing:.9px}
html body .sec-label{margin:12px 0 6px;font-size:10.5px}
html body .view-h{margin:0 0 10px;gap:8px;align-items:center}
html body .view-h h1,#view h1{font-size:19px;letter-spacing:-.4px;margin:2px 0 0;line-height:1.2}
.view-h p,.welcome p{font-size:var(--c-fs-s);margin:2px 0 0}
.hico{width:26px!important;height:26px!important;margin-right:6px!important;vertical-align:-6px!important}
html body .btn{padding:6px 11px;font-size:12px;min-height:var(--c-ctl);border-radius:9px}
html body .btn:hover{transform:none}
#view input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),#view select{min-height:var(--c-ctl);padding:5px 9px;font-size:var(--c-fs);border-radius:8px}
#view textarea{padding:7px 9px;font-size:var(--c-fs)}
select{padding:5px 8px;font-size:12px}
.status{padding:6px 10px;margin-bottom:8px;font-size:11.5px;border-radius:8px}
.pill,.market-badge{font-size:9.5px;padding:2px 6px}
.chart{height:clamp(240px,38vh,360px)}
footer{font-size:10.5px!important;padding:8px 0 !important}
footer span{display:block}

/* ---------- 3. Lưới: bỏ ép cột 240px, dùng cột gọn ---------- */
#view .index-grid{grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:8px;margin-bottom:var(--c-gap)}
#view .cards{grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:8px;margin-bottom:var(--c-gap)}
#view .content-grid{grid-template-columns:minmax(0,1.7fr) minmax(280px,1fr);gap:var(--c-gap);margin-bottom:var(--c-gap)}
#view :is(.dashboard-grid,.analysis-grid,.an-grid,.fl-grid,.focus-grid,.acc-grid,.st-grid,.nw-grid,.thm-grid,.mc-grid,.tr-grid,.tr-risk-grid,.al-grid,.level-grid,.pt-fields,.od-fields){grid-template-columns:repeat(auto-fit,minmax(min(100%,200px),1fr));gap:var(--c-gap)}
html body .index-card,html body .dashboard-kpis .index-card{padding:9px 11px!important;border-radius:10px}
.index-card>strong{font-size:19px;margin-top:4px}
.index-card small{margin-top:5px}
.change{font-size:11.5px;margin-top:1px}
.sparkline{font-size:30px;bottom:10px}
.card-top{font-size:10.5px}

#view .content-grid{align-items:start}
#view .content-grid>.panel{margin-bottom:0}

/* ---------- 4. PC (>900px) ---------- */
@media(min-width:901px){
  html body[class],html body{--c-top:48px}
  html[data-skin] .topbar{height:var(--c-top)!important;padding:0 16px!important;gap:10px!important}
  .nhip-mark{height:24px!important;width:auto!important}
  .brandname,.nhip-name{font-size:18px}
  .nhip-wm{height:26px!important;width:auto!important}
  .tagline{font-size:11px;padding-left:10px}
  .top-actions{gap:8px}
  .live{font-size:10.5px}
  html body .nh-strip{top:var(--c-top)!important;padding:4px 16px!important;gap:10px!important}
  .nh-t{min-height:30px!important;padding:3px 12px!important;flex-direction:row!important;gap:6px;border-radius:8px}
  .nh-t b{font-size:12.5px}.nh-t small{font-size:10.5px;display:inline}
  .nh-note{font-size:11.5px}
  html[data-skin] .shell{grid-template-columns:172px minmax(0,1fr)!important;max-width:1920px}
  html[data-skin] .sidebar{padding:12px 8px 12px 10px!important;gap:1px!important;min-height:calc(100vh - var(--c-top) - 40px)!important}
  html[data-skin] .sidebar .side-label{padding:8px 8px 3px;margin:0}
  html[data-skin] .nav{padding:6px 9px!important;font-size:12.5px!important;gap:9px!important;border-radius:8px!important;min-height:0!important}
  html[data-skin] .nav .ni,.nav svg{width:17px!important;height:17px!important}
  .side-footer{font-size:9.5px;padding:10px 6px 0}
  html body .main{padding:12px clamp(12px,1.4vw,22px) 12px!important}
  html[data-skin] .welcome h1{font-size:22px;letter-spacing:-.6px;margin:4px 0}
  .search{padding:10px;border-radius:10px}
}
/* PC rất rộng: tận dụng bề ngang, chia nhiều cột hơn */
@media(min-width:1500px){
  #view .index-grid{grid-template-columns:repeat(auto-fit,minmax(170px,1fr))}
  #view .content-grid{grid-template-columns:minmax(0,2fr) minmax(320px,1fr)}
}

/* ---------- 5. ĐIỆN THOẠI (≤900px) ---------- */
@media(max-width:900px){
  :root{--c-fs:13px;--c-top:44px;--c-pad:10px;--c-gap:8px;--c-rad:12px;--c-ctl:34px;--navh:52px}
  html[data-skin] .topbar{height:var(--c-top)!important;padding:0 10px!important;gap:6px!important}
  .nhip-mark{height:20px!important;width:auto!important}
  .nhip-wm{height:22px!important;width:auto!important}
  .brandname{font-size:17px}
  .tagline{display:none}
  .top-actions{gap:6px}
  .live{font-size:0}.live i{margin:0}
  html body .top-actions .btn{min-height:30px;padding:4px 9px;font-size:11.5px;border-radius:8px}
  html body .nh-strip{top:var(--c-top)!important;padding:4px 8px!important;border-bottom-width:2px}
  .nh-t{min-height:30px!important;padding:2px 6px!important;border-radius:8px}
  .nh-t b{font-size:13px}
  /* thanh điều hướng dưới thấp hơn, chừa thêm chỗ cho nội dung */
  #mnav{height:calc(var(--navh) + var(--safeb,0px))!important;padding:3px 4px var(--safeb,0px)!important}
  #mnav a,#mnav button{font-size:10.5px!important;gap:1px!important;border-radius:9px!important}
  #mnav .ni{width:20px!important;height:20px!important}
  html body .main{padding:8px 8px calc(var(--navh) + var(--safeb,0px) + 14px)!important}
  html body .view-h{margin:0 0 8px;flex-wrap:nowrap!important;align-items:center!important}
  .view-h>:first-child{flex:1 1 0;min-width:0}
  html body .panelhead{flex-wrap:nowrap!important;align-items:center}
  .panelhead>:first-child{min-width:0;flex:1 1 auto}
  .panelhead .btn{flex:0 0 auto}
  html body .view-h h1,#view h1{font-size:17px}
  html body .view-h .btn,#view .view-h button{width:auto!important;flex:0 0 auto;margin-left:auto}
  .view-h p{font-size:11px;line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
  .hico{width:22px!important;height:22px!important;margin-right:4px!important}
  html body .panel{padding:var(--c-pad)!important;margin-bottom:var(--c-gap);border-radius:var(--c-rad)}
  html body .panelhead h2,#view h2{font-size:14px}
  /* số liệu: 2 cột để thấy nhiều thẻ trong 1 màn hình */
  #view .index-grid,#view .cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
  html body .index-card{padding:8px 10px!important}
  .index-card>strong{font-size:16.5px}
  .index-card small,.card-top{font-size:10px}
  #view :is(.dashboard-grid,.analysis-grid,.an-grid,.fl-grid,.focus-grid,.acc-grid,.st-grid,.nw-grid,.thm-grid,.mc-grid,.tr-grid,.tr-risk-grid,.al-grid,.level-grid,.pt-fields,.od-fields){grid-template-columns:repeat(auto-fit,minmax(min(100%,150px),1fr));gap:8px}
  #view .content-grid{grid-template-columns:minmax(0,1fr);gap:var(--c-gap)}
  #view table{font-size:11.5px}
  #view th,#view td,.db-table th,.db-table td,.tbl th,.tbl td{padding:4px 5px!important}
  #view th{font-size:10.5px}
  /* ô nhập 16px để iOS không tự phóng to khi chạm */
  #view input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),#view select,#view textarea{font-size:16px;min-height:var(--c-ctl);padding:4px 9px}
  .chart{height:clamp(220px,34vh,300px)}
  .ai-widget{bottom:calc(var(--navh) + var(--safeb,0px) + 8px)!important;right:8px!important}
  .ai-launcher{width:42px!important;height:42px!important}
  .ai-launcher .ni{width:21px!important;height:21px!important}
  footer{padding:4px 0 8px!important}footer span{display:none}
  .ms-grid{gap:8px}.ms-grid a{min-height:68px!important;font-size:12px!important;border-radius:12px!important}
  .ms-grid .ni{width:22px!important;height:22px!important}
}
@media(max-width:380px){
  html body .main{padding-left:6px!important;padding-right:6px!important}
  #view .index-grid,#view .cards{gap:5px}
}
/* Tôn trọng cài đặt cỡ chữ của người dùng (Cài đặt → Cỡ chữ) */
html[data-fs="s"] body{font-size:12px}
html[data-fs="l"] body{font-size:14px}
