/* V26.8 Sales planning view */
.plan-root{min-width:0}.plan-toolbar{margin-top:16px}.plan-toolbar .text-input{flex:1 1 180px;max-width:350px}
.plan-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:13px 0}.plan-kpis>div{padding:12px 14px;border:1px solid #e1e8f1;border-radius:11px;background:#f8fbff}.plan-kpis b{display:block;font-size:21px;color:#213a5f}.plan-kpis span{font-size:11px;color:#667d99}
.plan-table{min-width:1050px}.plan-table td{max-width:250px}.plan-table td:last-child{text-align:center}
.plan-detail{padding:14px;background:#f8fbff;border:1px solid #e1e9f4;border-radius:10px}.plan-detail h3{margin:0 0 10px;color:#25456a}.plan-detail-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:8px}.plan-detail-grid>div{padding:8px;background:#fff;border:1px solid #edf1f7;border-radius:7px}.plan-detail-grid span{font-size:11px;color:#7487a0;display:block;margin-bottom:3px}.plan-detail-grid strong{font-size:13px;overflow-wrap:anywhere}.plan-detail p{font-size:11px;color:#6f8198;margin-bottom:0}
@media(max-width:800px){.plan-kpis{grid-template-columns:repeat(2,1fr)}.plan-toolbar .text-input{max-width:none}}
.plan-product-image{max-width:180px;max-height:120px;object-fit:contain;border-radius:8px;border:1px solid #e3eaf3;float:right;margin:0 0 12px 18px}

/* V26.9 Excel-style striped planning grid, column filters, page jump. */
.plan-table{border-collapse:separate;border-spacing:0;table-layout:auto}.plan-table th,.plan-table td{border-right:1px solid #dbe3ed!important;border-bottom:1px solid #dbe3ed!important;padding:10px 12px!important;vertical-align:middle!important}.plan-table th:first-child,.plan-table td:first-child{border-left:1px solid #dbe3ed!important}.plan-table thead th{border-top:1px solid #dbe3ed!important;background:#eaf0f8!important;color:#29486d!important;position:sticky;top:0;z-index:2}.plan-table tbody tr.plan-item td{background:#fff}.plan-table tbody tr.plan-item.plan-stripe td{background:#f0f5fb!important}.plan-table tbody tr.plan-item:hover td{background:#e0edfa!important}.plan-table .xl-filter-header{display:flex;justify-content:space-between;align-items:center;gap:5px;white-space:nowrap}.plan-table .xl-filter-btn{flex:none}.plan-table .plan-expanded td{background:#f6faff!important}.plan-pager{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:center}.plan-page-input{width:66px;min-height:34px;padding:5px 7px;text-align:center;border:1px solid #c7d5e7;border-radius:7px;font:inherit;color:#223e61;background:#fff}.plan-page-label{font-size:13px;color:#546782}

/* V26.11: same table headers and Enter-only pager as production */
.plan-table thead th{background:#215c98!important;color:#fff!important;border-color:#3c77ac!important}
.plan-table thead th .xl-filter-header{color:white!important}
.plan-pager{justify-content:center}
.plan-page-label{font-weight:600}
.plan-pager .plan-page-input{width:74px;font-size:16px}

.plan-finance-hidden{padding:10px 12px;margin:8px 0;background:#f4f7fb;border:1px solid #dbe4ee;border-radius:8px;color:#586a82;font-size:12px}

/* V26.16: thumbnail within the original flat Excel-style table. */
.plan-table{min-width:1120px}
.plan-table .plan-product-cell{min-width:150px;max-width:290px;white-space:normal;overflow-wrap:anywhere}
.plan-table .plan-thumb-cell{width:90px;min-width:90px;text-align:center;padding:5px!important}
.plan-table .plan-image-head{width:90px;min-width:90px;text-align:center}
.plan-table .plan-action-cell{min-width:90px;text-align:center}
.plan-table .plan-action-cell .btn{white-space:nowrap}
.plan-image-button{display:inline-flex;align-items:center;justify-content:center;padding:3px;border:1px solid #dce6f3;border-radius:7px;background:#fff;cursor:zoom-in;max-width:78px}
.plan-image-button:hover{border-color:#215c98;box-shadow:0 0 0 2px #215c9822}
.plan-thumb{width:66px;height:52px;max-width:100%;object-fit:contain;display:block;pointer-events:none}
.plan-photo-empty{color:#9aa9b9}
.plan-detail-image{float:right;max-width:182px;max-height:150px;padding:4px;margin:0 0 10px 16px;background:#fff;border:1px solid #dce6f3;border-radius:9px;cursor:zoom-in}
.plan-detail-image img{display:block;width:100%;max-height:132px;object-fit:contain}
.plan-photo-mask[hidden]{display:none!important}
.plan-photo-mask{position:fixed;inset:0;background:rgba(8,18,35,.72);z-index:99999;display:flex;align-items:center;justify-content:center;padding:20px}
.plan-photo-dialog{max-width:min(95vw,980px);max-height:95vh;display:flex;flex-direction:column;gap:10px;position:relative;padding:14px;background:#fff;border-radius:12px;box-shadow:0 20px 80px #0004;color:#173559;text-align:center}
.plan-photo-dialog img{max-width:100%;max-height:calc(95vh - 110px);object-fit:contain}
.plan-photo-close{position:absolute;right:8px;top:7px;border:0;border-radius:50%;width:34px;height:34px;background:#edf3fa;color:#173559;font-size:25px;cursor:pointer}


/* V26.29 warning view shares plan table styles and actions. */
.ph29-warnings-root .ph29-warning-cell{min-width:200px;text-align:left!important}
.ph29-warning{font-size:11px;line-height:1.5;margin:2px 0;white-space:normal}
.ph29-warning.is-late{color:#bd2838}.ph29-warning.is-urgent{color:#d65b1b}.ph29-warning.is-warning{color:#ae730a}


/* V26.30: full-width compact tables, inline row details, selectable/copyable text. */
.plan-root .plan-table{width:100%;min-width:1050px;table-layout:fixed}
.plan-root .plan-table th,.plan-root .plan-table td{box-sizing:border-box;padding:8px 6px!important;font-size:11px;line-height:1.35;min-width:0;max-width:none;white-space:normal;overflow-wrap:anywhere;word-break:normal}
.plan-root .plan-table th{font-size:10px;letter-spacing:0;text-align:left}
.plan-root .plan-table .xl-filter-header{min-width:0;white-space:normal;align-items:flex-start;gap:3px}
.plan-root .plan-table .xl-filter-header span{min-width:0;white-space:normal;overflow-wrap:anywhere;flex:1}
.plan-root .plan-table .xl-filter-btn{min-width:18px;width:18px;padding:1px 2px;line-height:1.25;font-size:10px;flex:none}
.plan-root .plan-table td.plan-product-cell{min-width:0;max-width:none}
.plan-root .plan-table td.plan-thumb-cell,.plan-root .plan-table th.plan-image-head{min-width:0;width:auto;padding:4px!important;text-align:center}
.plan-root .plan-table .plan-image-button{padding:2px;max-width:100%;width:100%}
.plan-root .plan-table .plan-thumb{width:100%;height:45px;max-width:100%;object-fit:contain}
.plan-root .plan-table tbody tr.plan-item{cursor:pointer}
.plan-root .plan-table tbody tr.plan-item:focus-visible{outline:2px solid #3174bd;outline-offset:-2px}
.plan-root .plan-table tbody tr.plan-item,.plan-root .plan-table tbody tr.plan-item td,.plan-root .plan-table tbody tr.plan-item td *{user-select:text!important;-webkit-user-select:text!important}
.plan-root .plan-table tbody tr.plan-item button{user-select:none!important;-webkit-user-select:none!important}
.plan-root .plan-table .plan-expanded td{padding:10px!important;text-align:left}
.plan-root .plan-table .plan-detail{max-width:100%;min-width:0}
.plan-root .plan-table .plan-detail-grid{grid-template-columns:repeat(auto-fit,minmax(130px,1fr))}
.plan-root .plan-table .ph29-warning-cell{text-align:left!important;padding:6px!important;vertical-align:middle}
.plan-root .plan-table .ph29-warning{font-size:10px;line-height:1.4;white-space:normal;overflow-wrap:anywhere}
/* Fill the entire status cell; these specific selectors override stripe/hover backgrounds. */
.plan-root .plan-table tbody tr.plan-item td.plan-state-cell{font-weight:750;text-align:center}
.plan-root .plan-table tbody tr.plan-item td.plan-state-cell.is-complete{background:#d6f5e4!important;color:#136a40!important}
.plan-root .plan-table tbody tr.plan-item td.plan-state-cell.is-neutral{background:#e9eef4!important;color:#43536a!important}
.plan-root .plan-table tbody tr.plan-item td.plan-state-cell.is-warning{background:#fff0bc!important;color:#8d5b04!important}
.plan-root .plan-table tbody tr.plan-item td.plan-state-cell.is-urgent{background:#ffdcc1!important;color:#a3430c!important}
.plan-root .plan-table tbody tr.plan-item td.plan-state-cell.is-late{background:#ffd7dd!important;color:#a4142f!important}
.plan-root .plan-table .ph29-warning.is-complete{color:#136a40}
.plan-root .plan-table .ph29-warning.is-neutral{color:#43536a}
/* The compact warning page keeps all its columns within the usable desktop width. */
.ph29-warnings-root .plan-table{min-width:1050px}
@media(max-width:1250px){.plan-root{padding:12px}.plan-root .plan-table th,.plan-root .plan-table td{padding:6px 4px!important;font-size:10px}.plan-root .plan-table .plan-thumb{height:38px}}
@media(max-width:700px){.plan-root .plan-table{min-width:970px}}


/* V26.35 – three legible detail groups shared by Kế hoạch and Cảnh báo. */
.plan-root .plan-table .plan-expanded>td{padding:10px!important;background:#f5f8fc!important}
.plan-root .plan-table .plan-d35-detail{padding:15px;border:1px solid #d8e3f0;border-radius:13px;background:#f7faff;white-space:normal;color:#193657;text-align:left}
.plan-d35-detail,.plan-d35-detail *{box-sizing:border-box;user-select:text;-webkit-user-select:text}
.plan-d35-intro{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:13px}
.plan-d35-intro h3{margin:0;color:#142c4c;font-size:16px;font-weight:800}
.plan-d35-intro p{margin:3px 0 0!important;color:#647893;font-size:11px}
.plan-d35-overall{display:inline-block;max-width:230px;border-radius:8px;padding:7px 10px;font-weight:800;font-size:11px;text-align:center;background:#ecf2f9;color:#586a82}
.plan-d35-overall.is-complete{background:#d6f5e4;color:#136a40}
.plan-d35-overall.is-warning{background:#fff0bc;color:#8d5b04}
.plan-d35-overall.is-urgent{background:#ffdcc1;color:#a3430c}
.plan-d35-overall.is-late{background:#ffd7dd;color:#a4142f}
.plan-d35-group{margin-top:12px;border-radius:12px;border:1px solid #d9e4ee;background:#fff;overflow:hidden}
.plan-d35-group h4{display:flex;align-items:center;gap:9px;margin:0!important;padding:10px 14px;font-size:12px;font-weight:800;letter-spacing:.05px}
.plan-d35-group h4 span{display:inline-grid;place-items:center;border-radius:6px;width:24px;height:22px;background:#fff9;color:inherit;font-size:10px}
.plan-d35-order{border-color:#f3cacf}.plan-d35-order h4{color:#a52c3a;background:#fff0f1}
.plan-d35-shipment{border-color:#bde4c8}.plan-d35-shipment h4{color:#167947;background:#ecf9f0}
.plan-d35-production{border-color:#c3dafa}.plan-d35-production h4{color:#1d5d9b;background:#edf5ff}
.plan-d35-fields{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:8px;padding:12px}
.plan-d35-field{background:#fff;border:1px solid #e4eaf2;border-radius:8px;min-height:57px;padding:8px 9px;min-width:0}
.plan-d35-field span{display:block;font-size:10px;color:#7385a0;line-height:1.35;margin-bottom:4px}
.plan-d35-field strong{display:block;font-size:12px;color:#183355;font-weight:750;line-height:1.35;white-space:pre-wrap;overflow-wrap:anywhere}
.plan-d35-field strong.is-late{color:#be263b}
.plan-d35-order-layout{display:flex;align-items:stretch;gap:5px}
.plan-d35-order-layout .plan-d35-fields{flex:1;min-width:0}
.plan-d35-photo{flex:none;align-self:stretch;width:150px;margin:12px 12px 12px 3px;border:1px solid #d4e0ed;border-radius:9px;background:#fff;padding:4px;cursor:zoom-in}
.plan-d35-photo img{width:100%;height:110px;object-fit:contain;display:block}
.plan-d35-stage-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;padding:12px}
.plan-d35-stage-family{min-width:0;background:#f8fbff;border:1px solid #dce9f8;border-radius:10px;overflow:hidden}
.plan-d35-stage-family h5{margin:0;padding:8px 11px;font-size:11px;font-weight:800;background:#e6f0fc;color:#225785}
.plan-d35-stage-row{padding:9px 10px;border-top:1px solid #e4edf7}
.plan-d35-stage-row:first-of-type{border-top:none}
.plan-d35-stage-top{display:grid;grid-template-columns:1fr auto 38px;gap:6px;align-items:center;line-height:1.35}
.plan-d35-stage-top b{font-size:11px;font-weight:760;color:#234361;min-width:0;overflow-wrap:anywhere}
.plan-d35-stage-amount{font-size:10px;color:#526b88;text-align:right;white-space:nowrap}
.plan-d35-stage-top em{font-size:10px;font-weight:850;text-align:right;font-style:normal;color:#3a628a}
.plan-d35-bar{height:5px;border-radius:10px;background:#e7edf6;overflow:hidden;margin:7px 0 6px}
.plan-d35-bar i{display:block;height:100%;border-radius:10px;background:#367dc3}
.plan-d35-stage-row.is-complete .plan-d35-bar i{background:#22a360}
.plan-d35-stage-row.is-warning .plan-d35-bar i{background:#d7a025}
.plan-d35-stage-row.is-urgent .plan-d35-bar i{background:#e16c2d}
.plan-d35-stage-row.is-late .plan-d35-bar i{background:#d73b48}
.plan-d35-stage-bottom{display:flex;align-items:center;justify-content:space-between;gap:5px;min-height:17px}
.plan-d35-status{font-size:10px;font-weight:750;line-height:1.3;overflow-wrap:anywhere;color:#5a728c}
.plan-d35-status.is-complete{color:#16834b}
.plan-d35-status.is-warning{color:#b17a0d}
.plan-d35-status.is-urgent{color:#cb581c}
.plan-d35-status.is-late{color:#bb2638}
.plan-d35-has-qty{flex:none;font-size:9px;color:#497190;background:#eaf4ff;padding:2px 5px;border-radius:5px}
.plan-d35-stage-row.is-packing{background:#f0f7ff}
.plan-d35-stage-loading{grid-column:1/-1;padding:16px 12px;color:#60738e;background:#f8fbff;border-radius:8px;font-size:12px}
.plan-d35-alerts{padding:9px 12px 0;display:flex;gap:5px;flex-wrap:wrap}
.plan-d35-alerts span{font-size:10px;border-radius:6px;padding:4px 6px;background:#fff3e9;color:#a4561e}
.plan-d35-alerts span.is-late{background:#fff0f1;color:#b32236}
.plan-d35-alerts span.is-urgent{background:#fff0e5;color:#c05317}
@media(max-width:1600px){.plan-d35-fields{grid-template-columns:repeat(4,minmax(0,1fr))}.plan-d35-stage-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:920px){.plan-d35-stage-grid{grid-template-columns:1fr}.plan-d35-order-layout{flex-direction:column}.plan-d35-photo{width:160px;align-self:flex-start;margin:0 12px 12px}.plan-d35-fields{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:600px){.plan-d35-fields{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;padding:8px}.plan-d35-detail{padding:8px!important}.plan-d35-stage-grid{padding:8px}.plan-d35-stage-top{grid-template-columns:1fr auto 32px}}

/* V26.40 – predictable, equal-height rows on Kế hoạch and Cảnh báo.
   Details remain a separate expanded row; thumbnail presence cannot change row height. */
.plan-root .plan-table tbody tr.plan-item{height:76px!important;min-height:76px!important;max-height:76px!important}
.plan-root .plan-table tbody tr.plan-item>td{height:76px!important;max-height:76px!important;overflow:hidden!important;line-height:1.35!important;vertical-align:middle!important}
.plan-root .plan-table tbody tr.plan-item .plan-thumb{height:48px!important;max-height:48px!important;object-fit:contain}
.plan-root .plan-table tbody tr.plan-item td.plan-product-cell{overflow-wrap:anywhere;word-break:normal}
.plan-root .plan-table tbody tr.plan-item .ph29-warning-cell .ph29-warning{line-height:1.28;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
