:root{font-family:Inter,"Segoe UI",Arial,sans-serif;color:#24334b;background:#f3f6fa}*{box-sizing:border-box}body{margin:0;font-size:14px}button,input,select,textarea{font:inherit}button{cursor:pointer}.layout{display:flex;min-height:100vh}.sidebar{width:265px;flex:none;background:#12243d;color:#d7e3f3;min-height:100vh;position:sticky;top:0;height:100vh;overflow:auto;padding:20px 13px}.logo{display:flex;align-items:center;gap:12px;padding:5px 11px 25px;border-bottom:1px solid #ffffff17}.logo-mark{width:40px;height:40px;border-radius:11px;background:#2466b6;display:grid;place-items:center;font-size:23px;font-weight:800;color:white}.logo strong{font-size:19px;letter-spacing:.8px}.logo small{display:block;font-size:10px;color:#8ea8c8;margin-top:4px}.sidebar-caption{font-size:10px;letter-spacing:1.4px;color:#7e97b6;margin:23px 12px 9px}.groupbtn{width:100%;background:transparent;color:#b8cae2;border:0;border-radius:8px;padding:12px;display:flex;justify-content:space-between;align-items:center;text-align:left;font-weight:600}.groupbtn:hover,.groupbtn.open{background:#ffffff0e;color:white}.children{padding:3px 0 7px 18px}.navitem{display:block;width:100%;background:transparent;border:0;color:#9fb5d0;text-align:left;padding:10px 13px;border-radius:7px;font-size:13px}.navitem:hover{background:#ffffff12;color:white}.navitem.active{background:#2262ad;color:white;font-weight:600}.sidefoot{font-size:11px;color:#7692b4;margin:32px 12px}.main{flex:1;min-width:0}.topbar{height:67px;background:white;border-bottom:1px solid #e5ebf3;display:flex;justify-content:space-between;align-items:center;padding:0 30px}.crumb,.overline{font-size:11px;letter-spacing:.7px;color:#8090a4;font-weight:650}.topactions{display:flex;gap:15px;align-items:center}.mode{font-size:12px;color:#63758b}.mode select{border:1px solid #d9e2ed;padding:7px;border-radius:7px;background:white}.user{background:#dbeafe;color:#1d4e88;border-radius:50%;height:35px;width:35px;display:grid;place-items:center;font-weight:800}.page{max-width:1500px;margin:auto;padding:29px}.pagehead{display:flex;justify-content:space-between;align-items:center;gap:15px;margin-bottom:22px}h1{font-size:27px;margin:7px 0}#subtitle{color:#78879a;margin:0}.btn{padding:10px 15px;background:white;border:1px solid #d8e1ed;border-radius:8px;color:#34445c;font-weight:600}.btn:hover{background:#f1f5fa}.btn.primary{background:#2366b0;color:white;border-color:#2366b0}.btn.danger{color:#bc3d3d}.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:15px;margin-bottom:19px}.stat,.panel{background:white;border:1px solid #e4eaf2;border-radius:11px;box-shadow:0 2px 7px #10243a05}.stat{padding:21px}.stat small{color:#8392a4}.stat strong{display:block;font-size:26px;color:#1d385b;margin-top:12px}.panel{padding:22px;margin-bottom:17px}.panel h3{margin:0 0 16px;font-size:16px}.toolbar{display:flex;gap:10px;justify-content:space-between;align-items:center;margin-bottom:17px;flex-wrap:wrap}.search{border:1px solid #dbe3ee;padding:10px 12px;border-radius:8px;width:300px;max-width:100%}.tablewrap{overflow:auto}table{width:100%;border-collapse:collapse;min-width:650px;text-align:left}th,td{padding:13px;border-bottom:1px solid #edf1f6}th{background:#f8fafd;font-size:12px;color:#75849a}tbody tr:hover{background:#f7faff}tbody tr{cursor:pointer}.badge{display:inline-block;padding:5px 9px;border-radius:5px;font-size:12px;background:#eaf1fa;color:#315b91}.badge.good{background:#e8f6ef;color:#217a53}.badge.warn{background:#fff4e0;color:#a06b16}.badge.bad{background:#fcecec;color:#aa3535}.muted{color:#8594a7}.empty{text-align:center;padding:30px}.overlay{position:fixed;inset:0;background:#12243d80;display:flex;justify-content:flex-end;z-index:10}.drawer{width:min(690px,100%);height:100%;overflow:auto;background:white;padding:30px;box-shadow:-5px 0 25px #10203024}.drawerhead{display:flex;justify-content:space-between;align-items:center;margin-bottom:22px}.drawerhead h2{margin:0}.fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.field{display:flex;flex-direction:column;gap:7px;font-size:12px;font-weight:600;color:#61728a}.field input,.field select,.field textarea{padding:11px;border:1px solid #d8e2ed;border-radius:7px;color:#23364d;background:white}.field.full{grid-column:1/-1}.actions{display:flex;gap:9px;justify-content:flex-end;margin-top:25px}.hint{font-size:12px;color:#8b98aa}.flow{display:flex;flex-wrap:wrap;gap:9px}.step{border:1px solid #d8e6f6;background:#f2f7ff;color:#275e9e;padding:13px;border-radius:8px;font-weight:600}.flow .arrow{align-self:center;color:#91a6be}.alert{padding:12px 15px;background:#fff6e5;border:1px solid #f3dca7;border-radius:8px;margin-bottom:15px;color:#876021}.alert.error{background:#fff0f0;border-color:#efbaba;color:#a53636}.formgrid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}.formgrid input{width:100%;padding:10px;border:1px solid #dbe3ee;border-radius:7px}.formgrid label{font-size:12px;color:#697c92}.formgrid label input{margin-top:6px}#toast{position:fixed;bottom:22px;right:22px;z-index:15}.toastmsg{background:#1a385a;color:white;padding:13px 18px;border-radius:8px;box-shadow:0 6px 20px #0002}@media(max-width:1000px){.sidebar{width:225px}.stats{grid-template-columns:repeat(2,1fr)}.page{padding:18px}}@media(max-width:650px){.sidebar{width:160px;padding:10px 5px}.logo strong{font-size:14px}.logo-mark{display:none}.topbar{padding:8px;height:auto}.mode{font-size:10px}.pagehead{align-items:flex-start}.stats{grid-template-columns:1fr 1fr}.fields,.formgrid{grid-template-columns:1fr}}
/* Purchase document master/detail */
.purchase-drawer{width:min(1100px,96vw);max-width:1100px;overflow:auto}.purchase-cell{width:100%;min-width:78px;padding:8px;border:1px solid #dce3ec;border-radius:6px;font:inherit}.purchase-total{text-align:right;margin:16px 0;font-size:16px}.server-label{font-size:12px;color:#64748b;font-weight:700;letter-spacing:.03em}.purchase-drawer .tablewrap{overflow-x:auto}.purchase-drawer table{min-width:800px}.purchase-drawer .fields{margin-bottom:20px}

/* Đào ERP v4 */
#menu{overflow-y:auto;max-height:calc(100vh - 175px);scrollbar-width:thin}.drawer textarea{width:100%;min-height:90px;padding:10px;border:1px solid #dce3ec;border-radius:7px;font:inherit}.line-table{min-width:1100px}.line-table .purchase-cell{min-width:95px}.line-table th{white-space:nowrap}.line-amount{white-space:nowrap;font-weight:650}.purchase-drawer .fields{grid-template-columns:repeat(3,minmax(0,1fr))}.purchase-drawer .field{min-width:0}.purchase-drawer .field input{width:100%}@media(max-width:800px){.purchase-drawer .fields{grid-template-columns:1fr 1fr}}

/* Hide sidebar/menu scrollbar without disabling mouse-wheel or touch scrolling. */
.sidebar, #menu { scrollbar-width: none; -ms-overflow-style: none; }
.sidebar::-webkit-scrollbar, #menu::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* v12: wider data-entry forms, compact line actions and row-to-view behavior */
.drawer.wide-entry-drawer{width:min(1580px,calc(100vw - 275px));max-width:none;padding:28px 34px 34px;}
.wide-entry-drawer .tablewrap{width:100%;overflow-x:auto;overscroll-behavior-x:contain;}
.wide-entry-drawer .line-table{min-width:1170px;width:100%;table-layout:fixed;}
.wide-entry-drawer .line-table th,.wide-entry-drawer .line-table td{padding:9px 6px;}
.wide-entry-drawer .line-table th:nth-child(1){width:18%;}
.wide-entry-drawer .line-table th:nth-child(2){width:20%;}
.wide-entry-drawer .line-table th:nth-child(3){width:8%;}
.wide-entry-drawer .line-table th:nth-child(4){width:8%;}
.wide-entry-drawer .line-table th:nth-child(5){width:13%;}
.wide-entry-drawer .line-table th:nth-child(6){width:10%;}
.wide-entry-drawer .line-table th:nth-child(7){width:10%;}
.wide-entry-drawer .line-table th:nth-child(8){width:9%;}
.wide-entry-drawer .line-table th:last-child{width:74px;}
.wide-entry-drawer .line-table .purchase-cell{min-width:0;width:100%;}
.line-actions{display:flex;align-items:center;gap:5px;justify-content:center;}
.line-icon{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;min-width:32px;padding:0;border:1px solid #d8e1ed;border-radius:8px;background:#f8fafc;color:#28588b;font-size:19px;line-height:1;cursor:pointer;}
.line-icon:hover{background:#e8f1fb;}
.line-icon-danger{color:#b43e4c;border-color:#f1d7dc;background:#fff8f8;}
.line-icon-danger:hover{background:#ffe9ed;}
.record-row{cursor:pointer;}
.record-row:hover{background:#edf5ff;}
.record-row td:last-child{white-space:nowrap;}
@media(max-width:1100px){.drawer.wide-entry-drawer{width:calc(100vw - 90px);padding:24px;}}
@media(max-width:650px){.drawer.wide-entry-drawer{width:100vw;padding:16px;}}
