*{box-sizing:border-box}
:root{
  /* === Design system: Data-Dense Dashboard (ui-ux-pro-max) ===
     Blue data + amber highlight, brand IMV blue giữ cho accent nhận diện */
  --primary:#1E40AF;        /* xanh dương chủ đạo */
  --primary-600:#1d4ed8;--primary-700:#1e3a8a;
  --secondary:#3B82F6;
  --accent:#D97706;         /* amber – nhấn CTA/cảnh báo nhẹ */
  --imv:#0E7FB8;--imv-light:#3EC6F0;--imv-dark:#0a5f8c;--imv-gray:#8c9299; /* giữ tương thích */
  --navy:#0a5f8c;--navy2:#084d72;--blue:#1E40AF;--blue2:#1d4ed8;
  /* Header/sidebar xanh IMV (giữ nhận diện thương hiệu) */
  --head-1:#0a5f8c;--head-2:#0E7FB8;
  --bg:#F4F7FB;--main-bg:#F4F7FB;
  --card:#ffffff;--card-fg:#1E3A8A;
  --text:#16283a;--muted:#475569;--border:#DBE4F0;
  --green:#1ea55a;--red:#DC2626;--orange:#D97706;
  --ring:#1E40AF;
  --radius:10px;--radius-sm:7px;
  --shadow-sm:0 1px 2px #0b2a4412;--shadow-md:0 2px 8px #0b2a4418;
  --ease:180ms cubic-bezier(.4,0,.2,1);
}
html,body{margin:0;width:100%;height:100%;font-family:'Fira Sans','Segoe UI',Arial,sans-serif;color:var(--text);background:var(--bg);font-size:14px;-webkit-font-smoothing:antialiased}
button,input,textarea,select{font:inherit}
button{cursor:pointer;transition:background var(--ease),color var(--ease),box-shadow var(--ease),border-color var(--ease)}
/* Focus visible chuẩn accessibility */
a:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,[tabindex]:focus-visible{outline:2px solid var(--ring);outline-offset:2px;border-radius:4px}
.tabular,.stats b,.cs-stats,.mini-table .num{font-variant-numeric:tabular-nums}
.app-shell{height:100vh;min-width:1100px;display:grid;grid-template-columns:210px 1fr;grid-template-rows:58px 1fr;overflow:hidden}
/* ===== HEADER nền xanh ===== */
.topbar{grid-column:1/-1;background:linear-gradient(100deg,var(--head-1),var(--head-2));color:#fff;display:flex;align-items:center;gap:22px;padding:0 20px;box-shadow:0 2px 10px #06263c30;z-index:5}
.brand{display:flex;align-items:center;gap:12px;min-width:210px}
/* Logo: nhúng ảnh, chuyển TRẮNG trên nền xanh */
.imv-logo{height:30px;width:auto;display:block;filter:brightness(0) invert(1)}
.imv-logo-svg{filter:none}
.brand-sep{width:1px;height:26px;background:#ffffff40;flex:0 0 auto}
.brand-title{font-weight:600;font-size:16px;letter-spacing:.2px;white-space:nowrap;color:#fff}
/* Tabs chính trên header */
.main-tabs{display:flex;gap:2px;flex:1;height:100%;align-items:stretch}
.main-tabs .tab{border:0;background:transparent;color:#e2eefb;font-size:14px;font-weight:500;padding:0 18px;position:relative;border-radius:0;transition:color var(--ease),background var(--ease)}
.main-tabs .tab:hover{color:#fff;background:#ffffff18}
.main-tabs .tab.active{color:#fff;font-weight:600}
.main-tabs .tab.active:after{content:"";position:absolute;left:12px;right:12px;bottom:0;height:3px;background:#fff;border-radius:3px 3px 0 0}
.top-actions{display:flex;align-items:center;gap:14px;margin-left:auto}
.top-btn{border:0;background:transparent;color:#fff;padding:7px 10px;font-size:13px;opacity:.92;border-radius:7px;display:inline-flex;align-items:center;gap:6px}
.top-btn:hover{background:#ffffff18;opacity:1}
.top-user{font-size:13px;color:#eaf6ff;white-space:nowrap;display:inline-flex;align-items:center;gap:6px}
/* ===== SIDEBAR xanh ===== */
.sidebar{grid-row:2;grid-column:1;background:linear-gradient(180deg,#0c5a83,#083f5e);color:#fff;padding:14px 10px;display:flex;flex-direction:column}
.submenu{display:flex;flex-direction:column}
.submenu.hidden{display:none}
.nav-item{width:100%;height:44px;border:0;background:transparent;color:#eaf6ff;text-align:left;border-radius:8px;padding:0 14px;margin-bottom:3px;display:flex;align-items:center;gap:11px;font-weight:500;font-size:14px;transition:background var(--ease),color var(--ease)}
.nav-item svg{width:18px;height:18px;flex:0 0 auto;opacity:.9}
.nav-item.active{background:#ffffff;color:var(--imv-dark);font-weight:600;box-shadow:0 4px 12px #00203a3a}
.nav-item.active svg{opacity:1;color:var(--imv-dark)}
.nav-item:not(.active):hover{background:#ffffff1f}
.nav-sep{height:1px;background:#ffffff33;margin:8px 12px}
/* Cước vận chuyển: sub-tabs + máy tính cước */
.rate-subtabs{display:flex;gap:6px;border-bottom:2px solid var(--border,#e2e8f0);margin:6px 0 16px}
.rate-subtab{border:0;background:transparent;padding:9px 16px;font-weight:600;font-size:14px;color:#64748b;cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-2px;transition:color .15s,border-color .15s}
.rate-subtab:hover{color:var(--imv-dark,#0b3a5b)}
.rate-subtab.active{color:var(--primary-700,#1e40af);border-bottom-color:var(--primary-700,#1e40af)}
.rate-pane.hidden{display:none}
.quote-form{display:flex;flex-wrap:wrap;gap:14px;align-items:flex-end;margin-bottom:16px}
.quote-form label{display:flex;flex-direction:column;gap:5px;font-size:12.5px;font-weight:600;color:#475569}
.quote-form .ship-period{min-width:160px}
.quote-form input[type=number]{max-width:130px}
.quote-card{border:1px solid var(--border,#e2e8f0);border-radius:12px;padding:18px 20px;background:linear-gradient(135deg,#f8fbff,#eef5ff);max-width:560px}
.quote-route{font-size:14px;color:#334155;margin-bottom:14px}
.quote-nums{display:flex;flex-wrap:wrap;gap:22px}
.quote-nums>div{display:flex;flex-direction:column;gap:3px}
.quote-nums span{font-size:12px;color:#64748b}
.quote-nums b{font-size:16px;color:#0f172a}
.quote-total b{color:var(--primary-700,#1e40af);font-size:20px}
.rate-carrier-block{margin-bottom:22px}
.rate-carrier-block h4{margin:0 0 8px;color:var(--primary-700,#1e40af);font-size:15px}
/* ==== Cước vận chuyển: filter bar + dropdown đồng bộ ==== */
#view-ship-rate .rep-filters,
#view-ship-rate .quote-form{gap:14px 16px;padding:14px 16px;background:#f7fafd;border:1px solid var(--border);border-radius:10px;margin-bottom:16px}
#view-ship-rate .quote-form.quote-calculator{display:grid;grid-template-columns:minmax(180px,1fr) minmax(180px,1fr) minmax(190px,1fr) 142px auto;gap:10px;align-items:stretch;padding:14px;background:linear-gradient(135deg,#f8fbff,#f1f6fd)}
#view-ship-rate .rep-filters>label,
#view-ship-rate .quote-form>label{display:flex;flex-direction:column;gap:5px;font-size:12px;font-weight:600;color:var(--muted);text-transform:none}
/* Ô nhập + select đồng bộ chiều cao, bo góc, viền */
#view-ship-rate .rep-filters select,
#view-ship-rate .rep-filters input,
#view-ship-rate .quote-form select,
#view-ship-rate .quote-form input,
#view-ship-rate .quote-form .ship-period{height:40px;border:1px solid var(--border);border-radius:8px;padding:0 12px;font-size:13.5px;background:#fff;color:var(--text);transition:border-color .15s,box-shadow .15s;box-shadow:0 1px 2px #0f223a08}
#view-ship-rate select{-webkit-appearance:none;appearance:none;padding-right:32px;cursor:pointer;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231e40af' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 10px center}
#view-ship-rate .rep-filters select:focus,
#view-ship-rate .rep-filters input:focus,
#view-ship-rate .quote-form select:focus,
#view-ship-rate .quote-form input:focus{outline:none;border-color:var(--primary);box-shadow:0 0 0 3px #1e40af22}
/* độ rộng từng field trong bộ lọc Chi tiết cước */
#view-ship-rate .rep-filters .fld-kg{width:96px}
#view-ship-rate .rep-filters .fld-kg input{width:100%}
#view-ship-rate .rep-filters .fld-search{flex:1;min-width:220px}
#view-ship-rate .rep-filters .fld-search input{width:100%}
#view-ship-rate .rep-filters .btn{height:40px;align-self:flex-end;gap:6px}
#view-ship-rate .rep-filters .btn .ico{width:16px;height:16px}
/* ngày + select không bị flex:1 kéo giãn quá to */
#view-ship-rate .rep-filters>label>.ship-period{flex:none;min-width:0;width:auto}
#view-ship-rate .rep-filters input[type=date]{min-width:150px}
#view-ship-rate .rep-filters #scCarrier{min-width:170px}
/* Custom dropdown wrapper bên trong rep-filters label */
#view-ship-rate .rep-filters>label>.custom-select-wrapper{min-width:170px}
#view-ship-rate .rep-filters>label>.custom-select-wrapper .custom-select-trigger{height:40px;border:1px solid var(--border);border-radius:8px;padding:0 32px 0 12px;font-size:13.5px;background:#fff;box-shadow:0 1px 2px #0f223a08;width:100%}
#view-ship-rate .rep-filters>label>.custom-select-wrapper.open .custom-select-trigger{border-color:var(--primary);box-shadow:0 0 0 3px #1e40af22}
/* dropdown ĐVVC trong bảng (từng dòng) */
#view-ship-rate .sc-cell .sc-ncc{-webkit-appearance:none;appearance:none;padding-right:26px;cursor:pointer;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%231e40af' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 7px center}
#view-ship-rate .sc-cell .sc-ncc:focus,#view-ship-rate .sc-cell .sc-kg:focus{outline:none;border-color:var(--primary);box-shadow:0 0 0 2px #1e40af22}
.sc-cell{display:flex;gap:5px;align-items:center}
.sc-cell .sc-ncc{min-width:96px;padding:4px 6px;border:1px solid var(--border,#e2e8f0);border-radius:6px;font-size:12.5px}
.sc-cell .sc-kg{width:58px;padding:4px 6px;border:1px solid var(--border,#e2e8f0);border-radius:6px;font-size:12.5px;text-align:right}
/* Bảng co giãn cột + cuộn ngang rõ */
.table-wrap.resizable{overflow-x:auto;overflow-y:visible}
.table-wrap.resizable table{table-layout:fixed}
.table-wrap.resizable th{position:relative;overflow:hidden;text-overflow:ellipsis}
.table-wrap.resizable td{overflow:hidden;text-overflow:ellipsis;max-width:0}
.col-resizer{position:absolute;top:0;right:0;width:7px;height:100%;cursor:col-resize;user-select:none;z-index:2}
.col-resizer:hover,.col-resizer.dragging{background:linear-gradient(to right,transparent,var(--primary-700,#1e40af))}
/* thanh cuộn ngang dễ thấy */
.table-wrap.resizable::-webkit-scrollbar{height:11px}
.table-wrap.resizable::-webkit-scrollbar-thumb{background:#b6c2d4;border-radius:6px}
.table-wrap.resizable::-webkit-scrollbar-thumb:hover{background:#8695ab}
.table-wrap.resizable::-webkit-scrollbar-track{background:#eef2f7;border-radius:6px}
/* Tooltip nổi khi rê chuột */
#cellTip{position:fixed;z-index:9999;max-width:420px;background:#0f2540;color:#fff;font-size:12.5px;line-height:1.5;padding:8px 11px;border-radius:8px;box-shadow:0 8px 24px #0b203a55;pointer-events:none;opacity:0;transition:opacity .12s;white-space:normal;word-break:break-word}
#cellTip.show{opacity:1}
.tip-cell{cursor:help}
.address-cell{min-width:230px;max-width:300px;color:#334155}
.address-cell>span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* Tài liệu API cho APK */
.api-doc{margin-top:18px;border:1px solid var(--border,#e2e8f0);border-radius:10px;background:#fbfdff}
.api-doc>summary{cursor:pointer;padding:12px 16px;font-weight:600;color:var(--primary-700,#1e40af);display:flex;align-items:center;gap:8px;list-style:none;user-select:none}
.api-doc>summary::-webkit-details-marker{display:none}
.api-doc[open]>summary{border-bottom:1px solid var(--border,#e2e8f0)}
.api-doc-body{padding:14px 18px;font-size:13px;line-height:1.6;color:#334155}
.api-doc-body p{margin:0 0 8px}
.api-note{color:#64748b;font-size:12px}
.api-ep{margin:14px 0;padding:12px 14px;border:1px solid #e8eef6;border-radius:8px;background:#fff}
.api-desc{color:#475569;font-size:12.5px;margin:6px 0}
.api-m{display:inline-block;font-size:11px;font-weight:700;color:#fff;padding:2px 8px;border-radius:5px;margin-right:6px;letter-spacing:.3px}
.api-m.get{background:#1EA55A}.api-m.post{background:#D97706}
.api-code{background:#0f2540;color:#dbeafe;border-radius:7px;padding:10px 12px;margin:7px 0;overflow-x:auto;font-size:12px;line-height:1.45}
.api-code code{font-family:ui-monospace,Menlo,Consolas,monospace;white-space:pre}
.api-doc-body code{background:#eef2f7;color:#0f2540;padding:1px 5px;border-radius:4px;font-size:12px;font-family:ui-monospace,Menlo,Consolas,monospace}
.api-code code{background:none;color:inherit;padding:0}
.sidebar-bottom{margin-top:auto}.device-card{border:1px solid #ffffff1d;border-radius:8px;padding:13px 12px;line-height:25px;font-size:12px;color:#dce8f4}.device-card b{color:#5ee17c}.version{font-size:11px;color:#91a5bb;margin-top:13px}
.main{grid-column:2;grid-row:2;padding:10px 10px 7px;overflow:auto;background:var(--main-bg)}
.top-grid{display:grid;grid-template-columns:300px minmax(560px,1fr) 330px;gap:10px;align-items:stretch}
.left-column,.right-column{display:flex;flex-direction:column;gap:10px}.card{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow-sm);padding:14px}
.card h3{font-size:12px;color:var(--primary-700);margin:0 0 13px;font-weight:700;letter-spacing:.4px;text-transform:uppercase}
.scan-card{min-height:140px}.scan-input{height:42px;border:1px solid #9fc4ef;border-radius:7px;display:flex;overflow:hidden;box-shadow:0 0 0 2px #e9f3ff}
.scan-input input{flex:1;border:0;outline:0;padding:0 14px;color:var(--text)}.scan-input button{width:45px;border:0;background:#fff;color:#0864d4;font-size:19px}
.single-line{display:flex;justify-content:space-between;margin-top:15px;color:#29405c}.single-line b{font-weight:600}
.shipment-card{min-height:260px}.info-row{display:flex;justify-content:space-between;align-items:center;min-height:30px;color:#34485f}.info-row b{font-weight:500;color:#162a40;text-align:right}.badge{padding:5px 10px;border-radius:6px;font-size:11px}.neutral{background:#e8edf3;color:#516176}
.camera-card{min-height:410px;padding:12px;display:flex;flex-direction:column}.section-title{display:flex;align-items:center;justify-content:space-between;margin-bottom:9px}.section-title h3{margin:0}.camera-select{background:#0d1420;color:#fff;padding:8px 11px;border-radius:6px;font-size:11px}
.camera-view{flex:1 1 auto;min-height:360px;background:linear-gradient(135deg,#222d39,#111922);border-radius:7px;position:relative;overflow:hidden;display:grid;place-items:center;border:1px solid #202b38}
.camera-actions{flex:0 0 auto}
.camera-view:before{content:"";position:absolute;inset:0;background:radial-gradient(circle at 50% 40%,#62717f66 0,#111a25 70%);opacity:.85}
.camera-top-status{position:absolute;z-index:2;top:12px;right:12px;display:flex;gap:7px;align-items:center;color:#fff;font-size:11px}
.camera-top-status strong{margin-left:7px}.recording-dot{width:9px;height:9px;border-radius:50%;display:inline-block;background:#9ba9b8}.recording-dot.live{background:var(--red);box-shadow:0 0 0 4px #f2383820}
.scan-corners{position:absolute;inset:48px 18px 54px;border:3px solid transparent;background:linear-gradient(#fff,#fff) left top/40px 3px no-repeat,linear-gradient(#fff,#fff) left top/3px 40px no-repeat,linear-gradient(#fff,#fff) right top/40px 3px no-repeat,linear-gradient(#fff,#fff) right top/3px 40px no-repeat,linear-gradient(#fff,#fff) left bottom/40px 3px no-repeat,linear-gradient(#fff,#fff) left bottom/3px 40px no-repeat,linear-gradient(#fff,#fff) right bottom/40px 3px no-repeat,linear-gradient(#fff,#fff) right bottom/3px 40px no-repeat;z-index:1}
.camera-placeholder{z-index:1;text-align:center;color:#fff}.package{width:260px;height:130px;margin:auto;border-radius:3px;background:linear-gradient(145deg,#bd8551,#8f5b34);box-shadow:0 20px 35px #0008;display:grid;place-items:center;font-size:70px;color:#eac18d}.camera-message{background:#101923cc;padding:7px 12px;border-radius:4px;margin-top:12px;font-size:12px}
.camera-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
.camera-actions .btn{flex:1 1 120px;min-width:110px}
.cam-toggle{background:#eef2f7;color:#37506d;border-color:#d3dce6;font-weight:700}
.cam-toggle.cam-on{background:linear-gradient(180deg,#25b75a,#1c9b4d);color:#fff;border-color:#1c9b4d}
.cam-toggle.cam-hint{animation:camHint .4s ease 0s 4}
@keyframes camHint{0%,100%{box-shadow:0 0 0 0 #f2383800}50%{box-shadow:0 0 0 4px #f2383855;background:#ffe8e8}}.btn{height:39px;border-radius:var(--radius-sm);border:1px solid var(--border);background:#fff;color:#1c3857;font-weight:600;display:inline-flex;align-items:center;justify-content:center;gap:7px;padding:0 14px;transition:background var(--ease),box-shadow var(--ease),border-color var(--ease)}.btn svg{width:17px;height:17px;flex:0 0 auto}.btn:hover{box-shadow:var(--shadow-sm)}.btn.primary{background:var(--primary);color:#fff;border-color:var(--primary)}.btn.primary:hover{background:var(--primary-600)}.btn.danger{background:var(--red);color:#fff;border-color:var(--red)}.btn.danger:hover{background:#b91c1c}.btn.secondary{background:#fff}.btn.secondary:hover{background:#f1f5fb;border-color:#c3d3e8}.hidden{display:none!important}
.status-card{min-height:185px}.status-banner{height:39px;border:1px solid #dfe6ef;border-radius:6px;display:flex;align-items:center;gap:9px;padding:0 12px;margin-bottom:10px}.status-banner.live{background:#fff1f1;border-color:#ffcaca}.status-banner.live .recording-dot{background:var(--red)}
.stats div{display:flex;justify-content:space-between;line-height:28px}.stats span{color:#52647a}.stats b{font-weight:600}
.quick-card{min-height:108px}.quick-actions{display:grid;grid-template-columns:1fr 1fr 1fr;gap:7px}.quick-actions button{height:39px;border:1px solid #dce4ee;background:#fff;border-radius:6px;color:#24415e;font-size:12px}.quick-actions button:hover{background:#f4f8fc}.danger-text{color:#d82e2e!important}
.note-card{min-height:130px}.note-card textarea{width:100%;height:70px;border:1px solid #d9e1eb;border-radius:6px;resize:none;padding:10px;outline:none}.counter{text-align:right;color:#8b98a8;font-size:10px;margin-top:3px}
.recordings-card{margin-top:10px;padding:13px 14px;min-height:290px}.table-title{display:flex;justify-content:space-between;align-items:center}.table-title h3{margin-bottom:10px}.table-title span{font-size:11px;color:#718096}.table-wrap{overflow:auto}table{border-collapse:collapse;width:100%;min-width:930px;font-size:11px}th{background:#f6f8fb;color:#243b56;font-weight:700}th,td{border:1px solid #e2e7ed;padding:10px 8px;text-align:center;white-space:nowrap}tbody tr:hover{background:#f8fbff}.success{background:#e3f6e9;color:#1c9b4d;padding:5px 10px;border-radius:10px}.progress{background:#fff0d6;color:#c77b10;padding:5px 10px;border-radius:10px}.actions-cell button{border:0;background:transparent;color:#075fce;font-size:16px;margin:0 3px}.actions-cell .delete{color:#df3030}
.pagination{display:flex;justify-content:flex-end;align-items:center;gap:5px;margin-top:10px}.pagination button{min-width:30px;height:28px;border:1px solid #dce4ee;background:#fff;border-radius:5px;color:#36506d}.pagination .selected{background:var(--primary);color:#fff;border-color:var(--primary)}
.dot{width:9px;height:9px;border-radius:50%;display:inline-block;margin-right:7px}.green{background:#43cf63}.gray{background:#8392a3}
.modal-backdrop{position:fixed;inset:0;background:#001a304d;z-index:100;display:flex;align-items:flex-end;justify-content:flex-end;padding:48px 22px 50px}.modal{width:380px;background:#fff;border-radius:8px;border:1px solid #d9e0e8;box-shadow:0 18px 60px #00172f45;overflow:hidden}.modal-header{height:52px;display:flex;align-items:center;justify-content:space-between;padding:0 15px;border-bottom:1px solid #e4e8ee}.modal-header h3{margin:0;color:#073c77;font-size:13px}.modal-header button{border:0;background:none;font-size:23px;color:#64748b}.modal-section{padding:13px 15px;border-bottom:1px solid #edf0f4}.modal-section h4{margin:0 0 10px;font-size:11px;color:#123e70}.file-info div{display:flex;justify-content:space-between;line-height:26px;font-size:11px}.file-info span,.backup-label{color:#617188}.share-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:7px}.share-grid button{height:72px;background:#fff;border:1px solid #dce4ee;border-radius:6px;color:#075fce;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px}.share-grid button span{font-size:10px;color:#334b66}.backup-row{display:flex;gap:7px;margin-top:7px}.backup-row select{flex:1;border:1px solid #d8e0e9;border-radius:6px;padding:0 7px;font-size:11px;min-width:0}.backup-row .btn{height:36px;font-size:11px;padding:0 10px}.modal-footer{padding:10px 15px;display:flex;justify-content:flex-end}.modal-footer .btn{height:34px;padding:0 18px}
.toast{position:fixed;right:25px;bottom:50px;background:#102a45;color:#fff;padding:11px 16px;border-radius:6px;box-shadow:0 8px 25px #00182f40;opacity:0;transform:translateY(10px);pointer-events:none;transition:.2s;z-index:200;font-size:12px}.toast.show{opacity:1;transform:translateY(0)}
@media(max-width:1500px){
  .app-shell{grid-template-columns:185px 1fr}.top-grid{grid-template-columns:280px minmax(430px,1fr) 300px}.camera-view{min-height:420px}.camera-card{min-height:370px}.right-column .card{padding:11px}.quick-actions button{font-size:11px}
}
@media(max-width:1200px){.top-grid{grid-template-columns:270px 1fr}.right-column{grid-column:1/-1;display:grid;grid-template-columns:1fr 1fr 1fr}.status-card,.quick-card,.note-card{min-height:150px}.camera-view{min-height:360px}}

/* ===== Màn hình thấp (1366x768 và tương tự): nút không bị che ===== */
@media(max-height:820px){
  .main{padding:8px}
  .top-grid{gap:8px}
  /* Khung camera co theo không gian còn lại, có mức tối thiểu vừa phải */
  .camera-card{min-height:0}
  .camera-view{min-height:420px}
  .camera-actions{margin-top:8px}
  .btn{height:36px}
  /* Cột trái/phải gọn lại */
  .scan-card{min-height:0}
  .shipment-card{min-height:0}
  .shipment-card .info-row{min-height:26px}
  .card{padding:11px}
  .card h3{margin-bottom:9px}
  .newscan-btn{height:36px;margin-top:8px}
  .single-line{margin-top:10px}
  .products-card .product-list{min-height:80px}
}
@media(max-height:720px){
  .camera-view{min-height:240px}
  .shipment-card .info-row{min-height:23px;font-size:13px}
}

/* ===== SPA views ===== */
.view{display:none}.view.active{display:block}
/* View "Video hoàn trả": chiếm hết chiều cao để khung camera kéo full */
#view-work.active{height:100%;display:flex;flex-direction:column}
#view-work .top-grid{flex:1;min-height:0}
#view-work .camera-card{min-height:0}
#view-work .left-column,#view-work .right-column{min-height:0}

/* ===== Nút quét mã mới ===== */
.newscan-btn{width:100%;height:40px;margin-top:10px;font-size:13px;display:flex;align-items:center;justify-content:center;gap:6px}

/* ===== Camera select dropdown ===== */
.camera-select{display:flex;align-items:center;gap:8px}
.cam-res{background:#0d1420;color:#8fe1a6;padding:6px 9px;border-radius:6px;font-size:11px;font-weight:600;white-space:nowrap}
#cameraSelect{background:#0d1420;color:#fff;border:1px solid #2a3644;border-radius:6px;padding:6px 8px;font-size:11px;max-width:200px}
.camera-view.scan-flash{outline:3px solid #35d07f;outline-offset:-3px}

/* ===== Lịch sử / Báo cáo filters ===== */
.history-filters{display:flex;gap:8px;align-items:center}
.history-filters input{height:34px;border:1px solid #d3dce6;border-radius:6px;padding:0 10px;font-size:12px}
.history-filters input[type=text]{min-width:180px}
.history-filters .btn{height:34px;padding:0 12px;font-size:12px}
.day-chips{display:flex;flex-wrap:wrap;gap:6px;margin:12px 0}
.day-chip{border:1px solid #d6e0ea;background:#f4f8fc;border-radius:14px;padding:5px 12px;font-size:11px;color:#2c4a68}
.day-chip:hover{background:#e6f0fb;border-color:#a9cdf0}.day-chip b{color:#0d64d0}
.empty{text-align:center;color:#94a3b4;padding:20px!important}
.hint{color:#64748b;font-size:12px;margin:6px 0 14px;line-height:1.5}.hint code{background:#eef2f7;padding:1px 5px;border-radius:4px}

/* ===== Báo cáo ===== */
.stat-cards{display:grid;grid-template-columns:repeat(5,1fr);gap:10px;margin-bottom:16px}
.stat-card{background:linear-gradient(160deg,var(--primary),var(--primary-700));color:#fff;border-radius:var(--radius);padding:16px 14px;box-shadow:var(--shadow-sm)}
.stat-val{font-size:22px;font-weight:800}.stat-label{font-size:11px;opacity:.85;margin-top:4px}
.report-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.card.sub{border:1px solid #e6ebf1;box-shadow:none;padding:14px}.card.sub h4{margin:0 0 10px;color:#0b3f77;font-size:12px}
.mini-table{width:100%;border-collapse:collapse;font-size:12px}
.mini-table td{padding:8px 6px;border-bottom:1px solid #eef2f6}.mini-table .num{text-align:right;font-variant-numeric:tabular-nums}

/* ===== Cài đặt / Người dùng / Thông tin ===== */
.settings-list{display:flex;flex-direction:column;gap:10px}
.settings-item{display:flex;justify-content:space-between;align-items:center;border:1px solid #e6ebf1;border-radius:8px;padding:12px 14px;margin-bottom:8px}
.setting-edit{display:flex;gap:8px;align-items:center}
.setting-edit input{width:90px;height:36px;border:1px solid #d3dce6;border-radius:6px;padding:0 10px;font-size:14px;text-align:center}
.setting-edit .btn{height:36px;padding:0 16px}
.settings-item .hint{margin:3px 0 0}
.user-box{display:flex;align-items:center;gap:14px;margin:8px 0 14px}
.user-avatar{width:52px;height:52px;border-radius:50%;background:linear-gradient(160deg,#1470e0,#0b4ea6);color:#fff;display:grid;place-items:center;font-size:22px;font-weight:800}
.user-name{font-weight:700;font-size:15px;color:#12263d}.user-role{color:#64748b;font-size:12px;margin-top:2px}
.info-block{border:1px solid #e6ebf1;border-radius:8px;padding:6px 14px;margin-bottom:12px}
.info-block .info-row{border-bottom:1px solid #f0f3f7}.info-block .info-row:last-child{border-bottom:0}

/* ===== Cột phải: trạng thái gọn + sản phẩm ===== */
.right-column{display:flex;flex-direction:column;gap:10px;min-height:0;overflow:hidden}
.compact-card{padding:10px 12px;flex:0 0 auto}
.compact-status{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap}
.cs-left{display:flex;align-items:center;gap:8px;font-size:13px}.cs-left b{color:#12263d}
.cs-stats{display:flex;gap:10px;font-size:11px;color:#54657a;font-variant-numeric:tabular-nums}
.compact-actions{display:flex;align-items:center;gap:6px;margin-top:9px}
.compact-actions button{width:34px;height:32px;border:1px solid #dce4ee;background:#fff;border-radius:6px;color:#24415e;font-size:14px}
.compact-actions button:hover{background:#f4f8fc}.compact-actions .danger-text{color:#d82e2e}
.compact-actions input{flex:1;min-width:0;height:32px;border:1px solid #d9e1eb;border-radius:6px;padding:0 10px;font-size:12px;outline:none}
.compact-actions .counter{font-size:10px;color:#8b98a8;white-space:nowrap}

.products-card{flex:1 1 0;display:flex;flex-direction:column;min-height:0;padding:12px}
.products-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;flex:0 0 auto}
.products-head h3{margin:0}
.prod-summary{font-size:11px;color:#0b64d0;font-weight:700;background:#e9f2fd;padding:3px 9px;border-radius:10px}
.product-list{flex:1 1 0;overflow-y:auto;display:flex;flex-direction:column;gap:9px;min-height:0;padding-right:4px}
.prod-empty{color:#94a3b4;font-size:12px;text-align:center;padding:30px 10px}
.prod-item{border:1px solid #e6ebf1;border-radius:8px;padding:10px;display:flex;flex-direction:column;gap:7px;background:#fbfcfe}
.prod-name{font-weight:600;font-size:12px;color:#16263a;line-height:1.35}
.prod-meta{display:flex;gap:7px;margin-top:3px}
.prod-qty{font-size:11px;background:#eef2f7;color:#39506c;padding:2px 8px;border-radius:5px}
.prod-cond{font-size:11px;background:#e3f6e9;color:#1c9b4d;padding:2px 8px;border-radius:5px}
.prod-barcode{background:#fff;border:1px solid #eef1f5;border-radius:6px;padding:6px;text-align:center;overflow-x:auto}
.prod-barcode svg{max-width:100%;height:auto}
.no-sku{color:#b0271e;font-size:11px;padding:8px}

/* ===== DS Packer: thiết kế lại, chữ to, thoáng ===== */
#view-packer .table-title h3{font-size:16px}
#view-packer table{font-size:14px;min-width:820px}
#view-packer th{background:#eef4fb;color:#183a5e;font-weight:700;padding:13px 12px;font-size:13px;text-transform:uppercase;letter-spacing:.3px}
#view-packer td{padding:13px 12px;font-size:14px}
#view-packer tbody tr:nth-child(even){background:#fafcff}
#view-packer tbody tr:hover{background:#eef6ff}
#view-packer td:nth-child(2){font-weight:700;color:#0d3d70;font-family:'SF Mono',Menlo,monospace}
.pk-carrier{display:inline-block;background:#eaf1f8;color:#2c4a68;padding:4px 11px;border-radius:6px;font-size:13px;font-weight:600}
.pk-basket{font-weight:600;color:#0d64d0}
.packer-filters select,.packer-filters input{height:38px!important;font-size:14px!important}
.packer-filters .btn{height:38px!important;font-size:14px!important;padding:0 16px!important}
.pk-picked{background:#dff5e6;color:#1c9b4d;padding:6px 12px;border-radius:14px;font-weight:700;white-space:nowrap;font-size:13px;display:inline-block}
.pk-pending{background:#ffedd0;color:#c77b10;padding:6px 12px;border-radius:14px;font-weight:700;font-size:13px;display:inline-block}
.pk-cancelled{background:#fde2e2;color:#c81e1e;padding:6px 12px;border-radius:14px;font-weight:700;font-size:13px;display:inline-block}
.pk-none{color:#9aa7b6;font-size:13px}
#packerCount{font-size:13px;color:#4a5b70;font-weight:600}
/* Segmented control thay dropdown "Hôm nay" */
.seg{display:inline-flex;background:#eef2f7;border:1px solid #dbe3ec;border-radius:8px;padding:3px;gap:2px}
.seg-btn{border:0;background:transparent;color:#4a5b70;font-size:13px;font-weight:600;padding:6px 14px;border-radius:6px;cursor:pointer}
.seg-btn:hover{color:#0d64d0}
.seg-btn.active{background:#fff;color:#0d64d0;box-shadow:0 1px 3px #0b2a4420}
.date-range{display:flex;align-items:center;gap:8px;margin-top:10px;font-size:13px;color:#4a5b70}
.date-range input[type=date]{height:36px;border:1px solid #d3dce6;border-radius:6px;padding:0 10px;font-size:13px}
.date-range .btn{height:36px;padding:0 16px}
.auto-toggle{display:inline-flex;align-items:center;gap:6px;font-size:13px;color:#37506d;cursor:pointer;user-select:none}
.auto-toggle input{width:15px;height:15px;cursor:pointer}
.packer-foot{display:flex;justify-content:space-between;align-items:center;margin-top:14px}
.pk-check-one{border:1px solid #d3dce6;background:#fff;color:#0d64d0;width:32px;height:32px;border-radius:7px;font-size:15px;cursor:pointer}
.pk-check-one:hover{background:#eef6ff;border-color:#a9cdf0}
#packerPagination button{min-width:34px;height:34px;border:1px solid #dce4ee;background:#fff;border-radius:7px;color:#36506d;font-size:14px;font-weight:600;cursor:pointer}
#packerPagination button:hover:not(:disabled):not(.selected){background:#eef6ff}
#packerPagination button.selected{background:var(--primary);color:#fff;border-color:var(--primary)}
#packerPagination button:disabled{opacity:.4;cursor:default}
#packerPagination span{color:#94a3b4;padding:0 4px}

/* ===== Trạng thái + lịch sử ===== */
.badge.cancelled{background:#fde2e2;color:#c81e1e;font-weight:700}
.status-cell{display:flex;align-items:center;gap:8px;justify-content:flex-end}
.link-btn{border:0;background:none;color:#0d64d0;font-size:11px;font-weight:600;padding:0;cursor:pointer}
.link-btn:hover{text-decoration:underline}

.history-modal{width:460px;max-height:80vh;display:flex;flex-direction:column}
.history-modal .modal-section{overflow-y:auto}
.hist-order{margin-bottom:12px;font-size:13px;color:#12263d}
.hist-sub{font-size:11px;color:#64748b;margin-top:3px}
.hist-cancel{color:#c81e1e;font-weight:700}
.timeline{display:flex;flex-direction:column}
.tl-item{display:flex;gap:12px;padding-bottom:14px;position:relative}
.tl-item:not(:last-child) .tl-dot:after{content:"";position:absolute;left:5px;top:14px;width:2px;height:calc(100% - 6px);background:#dbe3ec}
.tl-dot{width:12px;height:12px;border-radius:50%;background:#c3ccd8;margin-top:2px;flex:0 0 auto;position:relative}
.tl-current .tl-dot{background:#1470e0;box-shadow:0 0 0 4px #1470e022}
.tl-name{font-weight:600;font-size:13px;color:#16263a}
.tl-current .tl-name{color:#0d64d0}
.tl-meta{font-size:11px;color:#64748b;margin-top:2px}

/* ===== Dải "Đã quay hôm nay" dưới khung camera ===== */
.recent-strip{flex:0 0 auto;margin-top:10px;border-top:1px solid #e6ebf1;padding-top:9px}
.recent-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:7px}
.recent-head h4{margin:0;font-size:12px;color:#073c77;font-weight:800;letter-spacing:.2px}
.recent-count{font-size:11px;color:#0b64d0;background:#e9f2fd;padding:2px 9px;border-radius:10px;font-weight:700}
.recent-list{display:flex;flex-direction:column;gap:6px;max-height:150px;overflow-y:auto}
.recent-empty{color:#9aa7b6;font-size:12px;padding:14px 6px;text-align:center}
.recent-item{display:flex;align-items:center;gap:10px;background:#fafcff;border:1px solid #e9eef4;border-radius:7px;padding:8px 11px}
.ri-code{font-weight:700;color:#0d3d70;font-family:'SF Mono',Menlo,monospace;font-size:13px}
.ri-meta{color:#5b6b7e;font-size:11px;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ri-actions{display:flex;gap:2px}
.ri-actions button{border:0;background:transparent;color:#075fce;font-size:15px;padding:2px 5px;cursor:pointer}
.ri-actions .delete{color:#df3030}

/* ===== Lịch làm việc ===== */
.sched-nav{display:flex;align-items:center;justify-content:space-between;background:linear-gradient(100deg,var(--imv-dark),var(--imv));color:#fff;border-radius:10px;padding:12px 16px;margin-bottom:12px}
.sched-arrow{width:42px;height:42px;border:2px solid #ffffff55;background:#ffffff22;color:#fff;border-radius:9px;font-size:18px;font-weight:700;cursor:pointer}
.sched-arrow:hover{background:#ffffff38}
.sched-center{text-align:center}
.sched-week{font-size:15px;font-weight:700}
.sched-sub{font-size:11px;color:#dbeefb;margin-top:2px}
.sched-toolbar{display:flex;align-items:center;gap:10px;margin-bottom:12px;flex-wrap:wrap}
.sched-toolbar .btn{height:38px;padding:0 16px}
.sched-rot{margin-left:auto;font-size:12px;color:#1c9b4d;background:#e3f6e9;padding:5px 12px;border-radius:12px;font-weight:600}
.sched-table{width:100%;border-collapse:collapse;font-size:14px}
.sched-table th{background:var(--imv);color:#fff;font-weight:600;font-size:12px;text-transform:uppercase;padding:11px 14px;text-align:left}
.sched-table th:first-child,.sched-table td:first-child{text-align:center;width:48px}
.sched-table th:last-child,.sched-table td:last-child{text-align:center;width:60px}
.sched-table td{padding:11px 14px;border-bottom:1px solid var(--border);color:#263238}
.sched-table td:first-child{font-weight:700;color:var(--imv-dark)}
.sched-table tr.even{background:#f2f8fd}.sched-table tr.fixed{background:#e8f5e9}
.sched-table .nc{font-weight:600;color:#14304a}.fixed .nc{color:#1c9b4d}
.sched-table .doff{font-weight:600;color:#c62828}.fixed .doff{color:#1c9b4d}
.badge.b-hc{background:#E8EAF6;color:#3949AB}.badge.b-c1{background:#E3F2FD;color:#1565C0}.badge.b-c2{background:#FFF8E1;color:#F57F17}
.ft{font-size:9px;background:#A5D6A7;color:#1c9b4d;border-radius:8px;padding:1px 6px;margin-left:6px;font-weight:700}
.xc{font-size:9px;background:#FFF8E1;color:#F57F17;border-radius:8px;padding:1px 6px;margin-left:6px;font-weight:700}
.rb{width:30px;height:30px;border:0;border-radius:7px;cursor:pointer;font-size:13px}
.rbe{background:#E3F2FD;color:#1565C0}.rbe:hover{background:#BBDEFB}
/* Khung giờ ca */
.shift-cards{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin:14px 0}
.shift-card{border-radius:12px;padding:22px;color:#fff}
.sc-hc{background:linear-gradient(150deg,#5C6BC0,#3949AB)}
.sc-c1{background:linear-gradient(150deg,#42A5F5,#1565C0)}
.sc-c2{background:linear-gradient(150deg,#FFB74D,#F57F17)}
.shift-name{font-size:15px;font-weight:700;opacity:.9}
.shift-time{font-size:28px;font-weight:800;margin:8px 0 4px}
.shift-lunch{font-size:12px;opacity:.85}
.shift-cards-sm{margin:0 0 14px}.shift-cards-sm .shift-card{padding:12px 16px}
.shift-cards-sm .shift-time{font-size:20px;margin:4px 0 0}
/* ===== Lịch làm việc — bố cục GỌN ===== */
.sched-card{display:flex;flex-direction:column;min-height:0}
.sched-bar{display:flex;align-items:center;gap:14px;flex-wrap:wrap;background:linear-gradient(100deg,var(--imv-dark),var(--imv));color:#fff;border-radius:10px;padding:8px 12px;margin-bottom:10px}
.sched-weekbox{display:flex;align-items:center;gap:8px}
.sched-arrow.sm{width:34px;height:34px;font-size:14px}
.sched-weekbox .sched-week{font-size:13px;font-weight:700;white-space:nowrap}
.sched-weekbox .sched-sub{font-size:10px;color:#dbeefb}
.btn.sm{height:32px;padding:0 12px;font-size:12px}
.sched-bar .btn.secondary{background:#ffffff22;color:#fff;border-color:#ffffff44}
.sched-bar .btn.secondary:hover{background:#ffffff33}
.shift-cards-inline{display:flex;gap:8px;margin-left:auto}
.shift-cards-inline .shift-card{padding:5px 12px;border-radius:8px;min-width:118px}
.shift-cards-inline .shift-name{font-size:11px;font-weight:700;opacity:.9}
.shift-cards-inline .shift-time{font-size:14px;font-weight:800;margin:0}
.sched-bar .sched-rot{margin-left:0;background:#ffffff22;color:#eaf6ff}
.save-week{height:36px;padding:0 16px;background:#25b75a;color:#fff;border:0;border-radius:8px;font-weight:700;font-size:13px;cursor:pointer;white-space:nowrap}
.save-week:hover{background:#1c9b4d}
/* Bảng compact: hàng thấp hơn, nhiều dữ liệu */
.sched-table.compact th{padding:8px 12px}
.sched-table.compact td{padding:7px 12px;font-size:13px}
.cell-shift{display:flex;align-items:center;gap:6px;justify-content:space-between}
.mini-edit{border:0;background:transparent;color:#0d64d0;cursor:pointer;font-size:12px;opacity:.5}
tr:hover .mini-edit{opacity:1}
.cell-clean{text-align:center}
.clean-tick{width:18px;height:18px;cursor:pointer;accent-color:var(--imv)}
/* Form modal nhân sự */
.fg{margin-bottom:12px}.fg label{display:block;font-size:12px;font-weight:600;color:var(--muted);margin-bottom:5px}
.fg .fi{width:100%;height:38px;border:1px solid #d3dce6;border-radius:7px;padding:0 11px;font-size:13px;font-family:inherit;color:var(--text);background:#fff}
.fg2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
#empBackdrop .modal{width:460px}
#empBackdrop .modal-footer{gap:8px}

/* ===== Trang Đang phát triển ===== */
.soon-box{background:#fff;border:1px solid var(--border);border-radius:12px;padding:60px 40px;text-align:center;max-width:520px;margin:40px auto}
.soon-icon{margin-bottom:12px}
.soon-box h2{color:var(--primary-700);font-size:20px;margin:0 0 8px}
.soon-box p{color:var(--muted);font-size:14px;margin:0}

/* ===== VẬN TẢI: BC Vận chuyển + Cước vận chuyển ===== */
.ship-layout{display:grid;grid-template-columns:1fr 340px;gap:12px;align-items:start}
.ship-main{display:flex;flex-direction:column;gap:12px;min-width:0}
.btn.sm{height:32px;padding:0 12px;font-size:12px}
.upload-zone{border:2px dashed #b9cbe0;border-radius:12px;background:#f7fafd;padding:26px 20px;display:flex;flex-direction:column;align-items:center;gap:10px;text-align:center;transition:background var(--ease),border-color var(--ease);cursor:pointer}
.upload-zone.drag{border-color:var(--primary);background:#eaf2fd}
.upload-zone .uz-ico{width:40px;height:40px;color:var(--primary);opacity:.8}
.upload-zone .uz-text{color:var(--muted);font-size:13px}
.ship-toolbar{display:flex;gap:8px;align-items:center;margin-top:12px;flex-wrap:wrap}
.ship-period{height:38px;border:1px solid var(--border);border-radius:var(--radius-sm);padding:0 12px;font-size:13px;flex:1;min-width:180px}
.bc-file-list{display:flex;flex-direction:column;gap:6px;margin-top:10px}
.bc-file{display:flex;align-items:center;gap:9px;background:#f4f8fc;border:1px solid var(--border);border-radius:7px;padding:8px 11px;font-size:13px}
.bc-file .ico{width:16px;height:16px;color:var(--primary)}
.bcf-name{flex:1;font-weight:600;color:#16283a;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bcf-size{color:var(--muted);font-size:11px}
.bcf-del{border:0;background:transparent;color:var(--red);font-size:15px;cursor:pointer;padding:2px 6px;border-radius:5px}
.bcf-del:hover{background:#fde2e2}
.inhouse-box{margin-top:14px;border:1px solid #cfe0f5;background:#f4f8fd;border-radius:10px;padding:12px 14px}
.ih-title{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--primary-700);margin-bottom:10px}
.ih-title .ico{color:var(--primary)}.ih-title span{color:var(--muted);font-weight:400;font-size:12px}
.ih-row{display:flex;align-items:flex-end;gap:12px;flex-wrap:wrap}
.ih-row label{font-size:12px;color:var(--muted);display:flex;flex-direction:column;gap:4px}
.ih-row input[type=date]{height:38px;border:1px solid var(--border);border-radius:var(--radius-sm);padding:0 10px;font-size:13px}
.bc-result{margin-top:12px;display:flex;flex-direction:column;gap:12px}
.bc-loading,.bc-err{padding:16px;text-align:center;border-radius:8px;font-size:13px}
.bc-loading{background:#eef4fb;color:var(--primary-700)}
.bc-err{background:#fde2e2;color:#c81e1e}
.bc-card{border:1px solid var(--border);border-radius:10px;overflow:hidden}
.bc-card-head{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:11px 13px;background:#f6f9fd;border-bottom:1px solid var(--border);flex-wrap:wrap}
.bc-badge{display:inline-block;background:#e3f2fd;color:var(--primary-700);font-size:11px;font-weight:700;padding:2px 9px;border-radius:10px;margin-left:6px}
.bc-badge.ai{background:#fff1d6;color:#c77b10}
.bc-actions{display:flex;gap:6px}
.bc-stats{display:flex;flex-wrap:wrap;gap:16px;padding:10px 13px;font-size:12px;color:var(--muted)}
.bc-stats b{color:#16283a}
.bc-preview{max-height:340px;overflow:auto;border-top:1px solid var(--border)}
.bc-preview table{font-size:11px}
.bc-preview th{position:sticky;top:0}
.bc-more{padding:8px 13px;font-size:11px;color:var(--muted);background:#fafcfe}
#bcHistoryTable th{background:#eef4fb;color:#183a5e}
/* Chat AI */
.ship-chat{display:flex;flex-direction:column;height:calc(100vh - 150px);position:sticky;top:0;padding:0;overflow:hidden}
.chat-head{display:flex;align-items:center;gap:8px;padding:12px 14px;border-bottom:1px solid var(--border);background:linear-gradient(100deg,var(--head-1),var(--head-2));color:#fff}
.chat-head h3{margin:0;color:#fff;font-size:14px;flex:1}
.chat-head .ico{color:#fff}
.chat-ctx{font-size:10px;color:#dbeefb;background:#ffffff22;padding:2px 8px;border-radius:10px}
.chat-body{flex:1;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:10px}
.chat-empty{color:#94a3b4;font-size:12px;text-align:center;padding:20px 10px;line-height:1.6}
.chat-bubble{max-width:88%;padding:9px 12px;border-radius:12px;font-size:13px;line-height:1.5;word-break:break-word}
.cb-user{align-self:flex-end;background:var(--primary);color:#fff;border-bottom-right-radius:3px}
.cb-ai{align-self:flex-start;background:#eef2f7;color:#16283a;border-bottom-left-radius:3px}
.cb-typing{opacity:.6;font-style:italic}
.chat-input{display:flex;gap:8px;padding:10px;border-top:1px solid var(--border);background:#fff;align-items:flex-end}
.chat-input textarea{flex:1;min-height:38px;max-height:140px;border:1px solid var(--border);border-radius:8px;padding:9px 12px;font-size:13px;font-family:inherit;line-height:1.4;outline:none;resize:none;overflow-y:auto}
.chat-input textarea:focus{border-color:var(--primary)}
.chat-input .btn{width:42px;height:38px;padding:0;flex:0 0 auto}
/* Cước vận chuyển */
.rate-tabs{display:flex;gap:6px;flex-wrap:wrap;margin:14px 0}
.rate-tab{border:1px solid var(--border);background:#f4f8fc;color:#37506d;font-size:13px;font-weight:600;padding:8px 16px;border-radius:8px;cursor:pointer;transition:all var(--ease)}
.rate-tab:hover{background:#e6f0fb;border-color:#a9cdf0}
.rate-tab.active{background:var(--primary);color:#fff;border-color:var(--primary)}
.rate-meta{font-size:12px;color:var(--muted);margin-bottom:12px;display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.rate-sheet-title{margin:16px 0 8px;color:var(--primary-700);font-size:13px;font-weight:700}
.rate-table{font-size:12px}
.rate-table td{border:1px solid #e6ecf3;padding:6px 9px;text-align:left;white-space:nowrap}
.rate-table tr:first-child td{background:#eef4fb;font-weight:700}
@media(max-width:1200px){.ship-layout{grid-template-columns:1fr}.ship-chat{height:520px;position:static}}
/* Báo cáo tổng hợp */
.rep-bar{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:14px}
.rep-title h3{margin:0}
.rep-filters{display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap}
.rep-filters select{height:38px;border:1px solid var(--border);border-radius:var(--radius-sm);padding:0 10px;font-size:13px;background:#fff;max-width:180px}
.rep-date{height:38px;border:1px solid var(--border);border-radius:var(--radius-sm);padding:0 8px;font-size:12px;background:#fff}
.rep-alerts{grid-column:1/-1}
.alert-table{width:100%;border-collapse:collapse;font-size:12px}
.alert-table th{background:#fde8e8;color:#c81e1e;padding:8px;text-align:center;position:sticky;top:0}
.alert-table td{border-bottom:1px solid #f0e0e0;padding:6px 8px;text-align:center}
.rep-alerts .table-wrap{max-height:340px;overflow:auto}
.rep-matrix{grid-column:1/-1}
.mx-table{width:100%;border-collapse:collapse;font-size:12px}
.mx-table th{background:var(--primary);color:#fff;padding:8px 10px;text-align:center;position:sticky;top:0;white-space:nowrap}
.mx-table td{border-bottom:1px solid #e6ecf3;padding:6px 10px;white-space:nowrap;font-variant-numeric:tabular-nums}
.mx-table tbody tr:hover{background:#f4f8fc}
.mx-table .mx-total{background:#eef4fb;border-top:2px solid var(--primary)}
.rep-matrix .table-wrap{overflow-x:auto}
.rep-kpis{display:grid;grid-template-columns:repeat(5,1fr);gap:10px;margin-bottom:14px}
.rep-kpi{background:linear-gradient(160deg,var(--primary),var(--primary-700));color:#fff;border-radius:var(--radius);padding:16px 14px;box-shadow:var(--shadow-sm)}
.rk-val{font-size:22px;font-weight:800;font-variant-numeric:tabular-nums}
.rk-lbl{font-size:11px;opacity:.9;margin-top:4px}
.rep-ai-box{background:#eef4fb;border:1px solid #cfe0f5;border-radius:10px;padding:14px 16px;margin-bottom:14px}
.rep-ai-head{display:flex;align-items:center;gap:8px;color:var(--primary-700);margin-bottom:8px}
.rep-ai-head .ico{color:var(--primary)}
.rep-ai-box p{margin:5px 0;font-size:13px;color:#16283a;line-height:1.55}
.rep-ai-rec{color:var(--primary-700)}
.rep-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.rep-panel{border:1px solid var(--border);border-radius:10px;padding:14px;background:#fff}
.rep-panel h4{margin:0 0 12px;color:var(--primary-700);font-size:13px;font-weight:700}
.svg-chart{width:100%;height:auto}
.chart-empty{color:#94a3b4;font-size:12px;text-align:center;padding:40px 10px}
.pie-wrap{display:flex;align-items:center;gap:16px;flex-wrap:wrap}
.svg-pie{width:180px;height:200px;flex:0 0 auto}
.pie-legend{display:flex;flex-direction:column;gap:5px;font-size:12px;flex:1;min-width:120px}
.pie-leg{display:flex;align-items:center;gap:7px;color:#16283a}
.pie-leg b{margin-left:auto;color:var(--primary-700)}
.pie-dot{width:11px;height:11px;border-radius:3px;flex:0 0 auto}
@media(max-width:1000px){.rep-kpis{grid-template-columns:repeat(2,1fr)}.rep-grid{grid-template-columns:1fr}}
.upl-replace{display:inline-flex;align-items:center;gap:6px;font-size:12px;color:var(--muted);cursor:pointer;white-space:nowrap}
.upl-replace input{width:15px;height:15px;cursor:pointer}
#invTable th,#trTable th{background:#eef4fb;color:#183a5e}
#invTable td,#trTable td{text-align:center}

/* ===== Webcam thật ===== */
/* ===== Icon SVG dùng chung (thay glyph, ui-ux-pro-max) ===== */
.ico{width:18px;height:18px;flex:0 0 auto;display:inline-block;vertical-align:-3px}
.ico-sm{width:14px;height:14px;vertical-align:-2px}
/* Nút icon-only trong bảng: canh giữa icon */
.ri-actions button,.actions-cell button,.compact-actions button,.pk-check-one,.rb,.mini-edit,#scanBtn,.link-btn{display:inline-flex;align-items:center;justify-content:center;gap:5px}
.ri-actions button .ico,.actions-cell button .ico,.compact-actions button .ico{width:16px;height:16px;vertical-align:0}
.pk-check-one .ico{width:16px;height:16px;vertical-align:0}
.rb .ico,.mini-edit .ico{width:14px;height:14px;vertical-align:0}
.top-btn .ico,.top-user .ico{width:16px;height:16px}
.package svg{width:88px;height:88px;color:#e3c79a;opacity:.85}
.soon-icon svg{width:56px;height:56px;color:var(--primary);opacity:.85}
.pk-basket .ico{width:14px;height:14px;vertical-align:-2px}
.sched-arrow .ico{width:18px;height:18px}
.save-week .ico{width:16px;height:16px}
/* Trạng thái ghi hình: link-btn mũi tên xuống */
.link-btn .ico-sm{vertical-align:-2px}

/* ===== Accessibility: tôn trọng prefers-reduced-motion ===== */
@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important;scroll-behavior:auto!important}
  .cam-toggle.cam-hint{animation:none}
}

.webcam-video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:0;background:#000;display:none}
.camera-view.camera-live .webcam-video{display:block}
.camera-view.camera-live:before{opacity:0}
.camera-view.camera-live .camera-placeholder{display:none}
.camera-view.camera-live .scan-corners{z-index:1}

/* Custom Select Redesign */
.custom-select-wrapper {
  position: relative;
  user-select: none;
  width: 100%;
}
.custom-select-trigger {
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 32px 0 12px;
  font-size: 13.5px;
  background: #fff;
  color: var(--text);
  display: flex;
  align-items: center;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px #0f223a08;
}
.custom-select-trigger:after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  transition: transform 0.2s;
}
.custom-select-wrapper.open {
  z-index: 999;
}
.custom-select-wrapper.open .custom-select-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px #1e40af22;
}
.custom-select-wrapper.open .custom-select-trigger:after {
  transform: translateY(-50%) rotate(180deg);
}
.custom-select-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
  display: none;
  flex-direction: column;
}
.custom-select-wrapper.open .custom-select-options {
  display: flex;
}
.custom-select-search {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
}
.custom-select-search input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 10px;
  font-size: 13px;
  outline: none;
  background: #f8fafc;
}
.custom-select-search input:focus {
  border-color: var(--primary);
  background: #fff;
}
.custom-select-list {
  display: flex;
  flex-direction: column;
}
.custom-option {
  padding: 9px 12px;
  font-size: 13.5px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.1s;
}
.custom-option:hover {
  background: #f1f5f9;
}
.custom-option.selected {
  background: #eff6ff;
  color: var(--primary-700);
  font-weight: 600;
}
.custom-option.empty {
  color: var(--muted);
  font-style: italic;
  pointer-events: none;
}

/* Outlined Field (Máy tính cước) */
#view-ship-rate .quote-form > label.outlined-field {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px 8px;
  background: #fff;
  min-height: 52px;
  justify-content: center;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
  position: relative;
}
#view-ship-rate .quote-form > label.outlined-field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px #1e40af22;
}
#view-ship-rate .quote-form > label.outlined-field > span {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 3px;
  line-height: 1;
  pointer-events: none;
}
/* Input số (trọng lượng) bên trong outlined-field */
#view-ship-rate .quote-form > label.outlined-field > input {
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  height: 22px !important;
  box-shadow: none !important;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  outline: none;
  min-width: 0;
  width: 100%;
}
#view-ship-rate .quote-form > label.outlined-field > select{
  border:0!important;background-color:transparent!important;padding:0 22px 0 0!important;
  height:22px!important;min-width:0!important;width:100%;box-shadow:none!important;
  font-size:14px!important;font-weight:600;color:#0f172a;outline:none;
  background-position:right center!important;
}
#view-ship-rate .quote-form > label.quote-weight{flex:0 0 142px;min-width:142px}
#view-ship-rate .quote-form > label.quote-weight input[type=number]{max-width:none}
#view-ship-rate .quote-form.quote-calculator #qCalc{height:52px;align-self:stretch;white-space:nowrap;padding:0 18px;box-shadow:0 2px 5px #1e40af2e}
#view-ship-rate .quote-form.quote-calculator #qCalc:hover{transform:translateY(-1px);box-shadow:0 4px 10px #1e40af3b}
@media (max-width:1150px){
  #view-ship-rate .quote-form.quote-calculator{grid-template-columns:repeat(2,minmax(190px,1fr));}
  #view-ship-rate .quote-form.quote-calculator #qCalc{min-height:52px;}
}
/* Custom select wrapper bên trong outlined-field */
#view-ship-rate .quote-form > label.outlined-field > .custom-select-wrapper {
  width: 100%;
}
#view-ship-rate .quote-form > label.outlined-field > .custom-select-wrapper .custom-select-trigger {
  border: none !important;
  background: transparent !important;
  padding: 0 20px 0 0 !important;
  height: 22px !important;
  box-shadow: none !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  color: #0f172a !important;
  width: 100%;
}
#view-ship-rate .quote-form > label.outlined-field > .custom-select-wrapper .custom-select-trigger:after {
  right: 0;
  width: 14px;
  height: 14px;
}
/* Dropdown list vẫn có viền và nền trắng */
#view-ship-rate .quote-form > label.outlined-field > .custom-select-wrapper .custom-select-options {
  border: 1px solid var(--border);
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
