/* Phân tích lợi nhuận (#/profit) */
.pf-filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.pf-filters label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.pf-filters .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.pf-filters .seg button { border: 0; background: transparent; padding: 8px 14px; font: inherit; color: var(--muted); cursor: pointer; min-height: 40px; }
.pf-filters .seg button.on { background: #102a56; color: #fff; }
.pf-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 12px 0; }
.pf-kpis .card { display: grid; gap: 2px; padding: 12px 14px; }
.pf-kpis small, .pf-kpis span { color: var(--muted); font-size: 12px; }
.pf-kpis b { font-size: 24px; letter-spacing: -.01em; }
.neg { color: #b42318; }
.pf-warn { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: #fff7e6; border: 1px solid #f3d9a4; border-radius: 10px; padding: 8px 12px; color: #7a4b00; margin-bottom: 12px; }
.pf-two { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 12px; margin-bottom: 12px; }
.pf-h { font-size: 14px; margin: 0 0 8px; }
.pf-chart { width: 100%; height: auto; display: block; }
.pf-chart .pf-grid { stroke: #ecebe7; } .pf-chart .pf-base { stroke: #b9b8b2; }
.pf-chart .pf-axis { font-size: 10px; fill: #8a8984; }
.pf-chart .pf-bar path { fill: #2a78d6; } .pf-chart .pf-bar path.neg { fill: #e34948; }
.pf-chart .pf-bar:hover path { opacity: .8; }
.pf-tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.pf-tabs button { border: 0; background: none; padding: 9px 12px; font: inherit; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; min-height: 40px; }
.pf-tabs button.on { color: inherit; font-weight: 600; border-bottom-color: #102a56; }
.pf-mbar { display: inline-block; height: 8px; border-radius: 0 4px 4px 0; background: #2a78d6; vertical-align: middle; }
.pf-click { cursor: pointer; } .pf-click:hover td { background: #f6f8fc; }
.pf-dialog { width: min(980px, 96vw); }
@media (max-width: 1100px) { .pf-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .pf-two { grid-template-columns: 1fr; } .pf-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pf-filters > label, .pf-filters > .btn { flex: 1 1 140px; } }
/* Biểu đồ không nhận kiểu icon SVG chung (stroke / fill / chữ đậm) của app. */
.pf-chart, .pf-chart * { stroke-width: 1; }
.pf-chart rect, .pf-chart path, .pf-chart text { stroke: none; }
.pf-chart text { font-weight: 400; font-family: inherit; }
.pf-chart line { fill: none; }
.pf-adjust { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 8px; }
.pf-hist { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.pf-staff { margin-bottom: 12px; display: grid; gap: 8px; }
.pf-check { background: #f1f8f4; border: 1px solid #cfe8da; border-radius: 10px; padding: 8px 12px; color: #0a5c36; margin: 0; }
.pf-check.bad { background: #fde8e8; border-color: #f5b5b5; color: #b42318; }
.pf-bridge td { padding: 7px 10px; } .pf-bridge tr.tot td { font-weight: 700; background: #f7f8fa; }

/* Bố cục theo mẫu giai đoạn 2 (07/11/2026). */
.pf-head { display: grid; gap: 6px; margin-bottom: 12px; }
.pf-head .pf-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pf-head h1 { margin: 0; }
.pf-head > p { margin: 0 0 6px; }
.pf-filters { align-items: center; }
.pf-filters .pf-check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: inherit; min-height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }
.pos { color: #0a7a43; }
.pf-check { margin: 0 0 12px; }
.pf-bridge td:first-child { min-width: 220px; } .pf-bridge th:nth-child(3), .pf-bridge td:nth-child(3) { width: 18%; min-width: 60px; }
.pf-bar-h { display: block; height: 8px; border-radius: 4px; background: #2a78d6; min-width: 2px; }
.pf-bar-h.neg { background: #c9ced6; }
.pf-bridge tr.tot .pf-bar-h { background: #102a56; }
.pf-notes { margin: 8px 0; padding-left: 18px; display: grid; gap: 4px; color: var(--muted); }
.pf-table select { min-height: 32px; font-size: 12px; max-width: 220px; }
@media (max-width: 760px) { .pf-kpis b { font-size: 20px; } .pf-filters .pf-check-inline { flex: 1 1 140px; } }
.pf-filters select, .pf-filters input { min-height: 40px; }
.pf-filters { gap: 8px; }
.pf-two { align-items: start; }
.pf-filters > select, .pf-filters > input { width: auto; flex: 0 0 auto; max-width: 240px; }
@media (max-width: 760px) { .pf-filters > select, .pf-filters > input { flex: 1 1 150px; max-width: none; } }

/* Keep filters editable, but do not display totals belonging to the previous range. */
#view-profit[data-pf-stale] .pf-results { visibility: hidden; }
#view-profit[aria-busy="true"] { pointer-events: auto; opacity: 1; }

/* Giá niêm yết / CK / giá vốn: bảng PC, thẻ có nhãn trên điện thoại. */
.pf-fill.modal { width: min(1200px, calc(100vw - 24px)); max-height: 92dvh; overflow: hidden; }
.pf-fill > form { display: flex; flex-direction: column; max-height: 92dvh; }
.pf-fill .modal-head { flex-shrink: 0; padding-bottom: 12px; gap: 12px; }
.pf-fill .modal-head h2 { font-size: 20px; }
.pf-fill .modal-head [data-x] { min-width: 44px; min-height: 44px; }
.pf-fill .modal-body { overflow-y: auto; min-height: 0; }
.pf-fill .modal-foot { flex-shrink: 0; }
.pf-fill .pf-cost-table { width: 100%; table-layout: fixed; }
.pf-fill .pf-cost-table th { white-space: normal; overflow-wrap: anywhere; }
.pf-fill .pf-cost-table th:first-child { width: 30%; }
.pf-fill .pf-cost-table th:nth-child(2) { width: 15%; }
.pf-fill .pf-cost-table th:nth-child(4) { width: 12%; }
.pf-fill .pf-cost-table td { white-space: normal; overflow-wrap: anywhere; vertical-align: top; }
.pf-cost-name { display: block; margin-top: 5px; }
.pf-fill .pf-cost-table small { color: var(--muted); font-size: 12px; }
.pf-fill .pf-cost-table input { width: 100%; min-width: 0; min-height: 44px; text-align: right; }
.pf-fill .pf-cost-table input[readonly] { background: var(--surface-2); color: var(--muted); }
@media (max-width: 760px) {
  .pf-fill .table-wrap { overflow: visible; }
  .pf-fill .pf-cost-table, .pf-fill .pf-cost-table tbody { display: block; min-width: 0; }
  .pf-fill .pf-cost-table thead { display: none; }
  .pf-fill .pf-cost-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
  .pf-fill .pf-cost-table td { display: block; padding: 0; border: 0; width: auto; text-align: left; min-width: 0; }
  .pf-fill .pf-cost-table td:first-child { grid-column: 1 / -1; }
  .pf-fill .pf-cost-table td::before { content: attr(data-label); display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
  .pf-fill .pf-cost-table td:first-child::before { display: none; }
  .pf-fill .modal-foot .btn { flex: 1; min-height: 44px; white-space: normal; }
}
