@font-face {
  font-family: "SVN-Sofia Pro";
  src: url("/assets/fonts/SofiaPro-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SVN-Sofia Pro";
  src: url("/assets/fonts/SofiaPro-Bold.ttf") format("truetype");
  font-weight: 600 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Bang mau CWI: xanh thuong hieu #0E518C */
  --primary: #0e518c;
  --primary-dark: #0a3d6b;
  --primary-soft: #e7eef5;
  --teal-muted: #5b84a8;
  --blue: #2489db;
  --blue-dark: #125c9e;
  --sidebar-bg: #0b2f52;
  --sidebar-hover: #134470;
  --sidebar-active: #1f73bd;
  --bg: #f3f7f9;
  --surface: #ffffff;
  --border: #dfe7ec;
  --text: #111827;
  --text-muted: #5b6b79;
  --success: #0d9488;
  --success-bg: #e6f7f4;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --info: #1d4ed8;
  --info-bg: #dbeafe;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(15, 41, 55, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 41, 55, 0.14);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: "SVN-Sofia Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.num {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.center {
  text-align: center;
}

.muted {
  color: var(--text-muted);
}

.small {
  font-size: 12px;
}

/* ---------- Login Screen ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #082440 0%, #0e518c 58%, #2f86c9 100%);
}

.login-card {
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border-radius: 16px;
  padding: 36px 32px 26px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

.login-brand {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo {
  height: 84px;
  object-fit: contain;
  margin-bottom: 12px;
}

.login-brand h1 {
  font-size: 19px;
  color: var(--sidebar-bg);
  font-weight: 700;
}

.login-company {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-top: 4px;
}

.login-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.login-footer {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.login-footer a {
  color: var(--primary-dark);
  text-decoration: none;
  font-weight: 600;
}

/* ---------- App Layout ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 256px;
  background: var(--sidebar-bg);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  transition: transform 0.2s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.brand-text strong {
  display: block;
  font-size: 15px;
  letter-spacing: 0.4px;
  color: #ffffff;
}

.brand-text span {
  font-size: 11px;
  color: #7dd3d5;
}

.warehouse-pill {
  margin: 14px 14px 8px;
  padding: 10px 12px;
  background: rgba(47, 134, 201, 0.14);
  border: 1px solid rgba(47, 134, 201, 0.35);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dot-online {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #34d399;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
}

.wp-title {
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
}

.wp-sub {
  font-size: 11px;
  color: #b7d7dc;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-section {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #7c97a6;
  padding: 12px 12px 4px;
}

button {
  font-family: inherit;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #d2e0e7;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(47, 134, 201, 0.35);
}

.nav-icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
}

.ext-link {
  color: #7dd3d5;
  text-decoration: none;
  font-weight: 600;
  display: block;
}

.ext-link:hover {
  text-decoration: underline;
}

.sf-meta {
  color: #8ea7b5;
  margin-top: 3px;
  font-size: 11px;
}

.main-wrap {
  margin-left: 256px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--sidebar-bg);
  line-height: 1.2;
}

.page-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 10px 5px 6px;
  background: var(--bg);
  border-radius: 999px;
  border: 1px solid var(--border);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.15;
}

.user-role {
  font-size: 11px;
  color: var(--primary-dark);
  font-weight: 600;
}

.main-content {
  padding: 22px 24px 40px;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- Cards, KPIs, Grids ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
}

.kpi-card.blue::before { background: var(--blue); }
.kpi-card.amber::before { background: var(--warning); }
.kpi-card.green::before { background: var(--success); }
.kpi-card.red::before { background: var(--danger); }

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--sidebar-bg);
  margin: 6px 0 4px;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 20px;
}

.grid-2 > *,
.form-row > *,
.form-row-3 > * {
  min-width: 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  min-width: 0;
  max-width: 100%;
}

.card-header {
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--sidebar-bg);
}

.card-body {
  padding: 16px 18px;
}

/* ---------- Toolbar & Filters ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-blue {
  background: var(--blue);
  color: #ffffff;
}
.btn-blue:hover:not(:disabled) {
  background: var(--blue-dark);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}
.btn-success:hover:not(:disabled) {
  background: #0f766e;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}
.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover:not(:disabled) {
  background: var(--bg);
  border-color: #b7c6d1;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg);
  color: var(--text);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 11.5px;
  border-radius: 5px;
}

.btn-block {
  width: 100%;
  padding: 11px 16px;
}

.icon-btn {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}
.icon-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: 13px;
}

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 5px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="email"],
select,
textarea {
  width: 100%;
  /* Sofia Pro co dau tieng Viet tren chu hoa (Ổ, Ầ, Ệ) vuot khung dong mac dinh:
     line-height 1.7 de o nhap khong cat mat dau; padding giam de giu chieu cao o. */
  padding: 5px 11px;
  line-height: 1.7;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

/* O chon khong cao theo line-height nhu o nhap, giu padding cu de hai loai cao bang nhau */
select {
  padding: 8px 11px;
  line-height: normal;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 134, 201, 0.16);
}

input.input-inline,
select.input-inline,
.input-inline {
  width: auto;
  min-width: 150px;
}

.input-group {
  display: flex;
  gap: 8px;
}

.input-group input {
  flex: 1;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 60px;
}

.icon-btn-inline {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 6px;
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  padding: 10px 9px;
  border-bottom: 2px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

tbody td {
  padding: 9px 9px;
  border-bottom: 1px solid #edf2f6;
  vertical-align: middle;
}

tbody tr:hover {
  background: #f9fcfd;
}

tfoot td {
  padding: 10px 9px;
  background: #f1f5f9;
  font-weight: 700;
  border-top: 2px solid var(--border);
}

.prod-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 185px;
  max-width: 245px;
}

.prod-thumb {
  width: 42px;
  height: 42px;
  border-radius: 7px;
  object-fit: contain;
  background: #f8fafc;
  border: 1px solid var(--border);
  flex-shrink: 0;
  padding: 2px;
}

.prod-sku {
  font-weight: 700;
  color: var(--sidebar-bg);
  font-size: 13px;
}

.prod-name {
  font-size: 12px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 340px;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: #0f766e; }
.badge-warning { background: var(--warning-bg); color: #b45309; }
.badge-danger  { background: var(--danger-bg);  color: #b91c1c; }
.badge-info    { background: var(--info-bg);    color: #1d4ed8; }
.badge-neutral { background: #e2e8f0; color: #334155; }
.badge-teal    { background: var(--primary-soft); color: var(--primary-dark); }

/* ---------- Alerts & Bars ---------- */
.alert-error {
  background: var(--danger-bg);
  color: #991b1b;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}

.alert-info {
  background: var(--primary-soft);
  color: #0e5a5c;
  border: 1px solid #b6e3e4;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}

.alert-warn {
  background: var(--warning-bg);
  color: #92400e;
  border: 1px solid #fcd34d;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}

.cat-bar-row {
  margin-bottom: 11px;
}
.cat-bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  margin-bottom: 4px;
}
.cat-bar-track {
  height: 8px;
  background: #e6eff3;
  border-radius: 99px;
  overflow: hidden;
}
.cat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--blue));
  border-radius: 99px;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 41, 55, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-dialog {
  background: var(--surface);
  border-radius: 14px;
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.modal-dialog.modal-lg {
  max-width: 980px;
}

.modal-dialog.modal-sm {
  max-width: 460px;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--sidebar-bg);
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* Line items editor inside modal */
.line-items-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: visible;
  margin-top: 10px;
}

.line-items-table th {
  padding: 8px 8px;
  font-size: 11.5px;
}

.line-items-table td {
  padding: 6px 6px;
}

.line-items-table input,
.line-items-table select {
  padding: 6px 8px;
  font-size: 13px;
}

.line-items-table .li-qty input {
  min-width: 72px;
  text-align: center;
  font-weight: 600;
}

.line-items-table .li-disc input {
  min-width: 64px;
  text-align: center;
}

.line-items-table .li-price input {
  min-width: 112px;
  text-align: right;
}

/* Searchable Model Product Picker */
.picker-wrap {
  position: relative;
  width: 100%;
}

.picker-input-box {
  position: relative;
  display: flex;
  align-items: center;
}

.picker-input {
  width: 100%;
  padding-right: 28px !important;
  font-weight: 600;
  color: var(--sidebar-bg);
}

.picker-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
}

.picker-clear:hover {
  background: #e2e8f0;
  color: var(--text);
}

.picker-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 360px;
}

.picker-dropdown {
  position: fixed;
  z-index: 400;
  background: var(--surface);
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  box-shadow: 0 12px 30px rgba(15, 41, 55, 0.22);
  max-height: 280px;
  overflow-y: auto;
  min-width: 340px;
}

.picker-opt {
  padding: 8px 11px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.1s;
}

.picker-opt:last-child {
  border-bottom: none;
}

.picker-opt:hover,
.picker-opt.active {
  background: var(--primary-soft);
}

.picker-opt-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.picker-opt-model {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--sidebar-bg);
}

.picker-opt-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 12px;
}

.picker-opt-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.picker-empty {
  padding: 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12.5px;
}

.summary-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 12px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13.5px;
}

.summary-row.grand {
  border-top: 1px dashed #cbd5e1;
  margin-top: 6px;
  padding-top: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-dark);
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}

.toast {
  padding: 12px 16px;
  border-radius: 9px;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  animation: fadeInToast 0.2s ease;
}

.toast.success { background: #0f766e; }
.toast.error   { background: #dc2626; }
.toast.info    { background: #1e40af; }

@keyframes fadeInToast {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
}

.tab-btn {
  padding: 9px 16px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.tab-btn.active {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
}

.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
}

.actions-cell {
  display: flex;
  gap: 5px;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

/* ---------- Mobile ---------- */
.mobile-only {
  display: none;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 35;
}

@media (max-width: 960px) {
  .mobile-only {
    display: inline-flex;
  }
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrap {
    margin-left: 0;
  }
  .grid-2,
  .form-row,
  .form-row-3 {
    grid-template-columns: 1fr;
  }
  .topbar {
    min-height: 56px;
    padding: 8px 14px;
  }
  .page-title {
    font-size: 15.5px;
  }
  .page-subtitle {
    display: none;
  }
  .main-content {
    padding: 16px 14px 36px;
  }
  .user-meta,
  #btn-change-pwd {
    display: none;
  }
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .tab-btn {
    flex-shrink: 0;
  }
}

/* Mobile-first Line Items Card Layout & Comfortable Touch Inputs (fixes squeezed SL column) */
@media (max-width: 768px) {
  .modal-overlay {
    padding: 6px;
    align-items: flex-end;
  }
  .modal-dialog,
  .modal-dialog.modal-lg {
    width: 100%;
    max-width: 100%;
    max-height: 94vh;
    border-radius: 14px 14px 8px 8px;
  }
  .modal-header {
    padding: 13px 14px;
  }
  .modal-body {
    padding: 12px 12px;
  }
  .modal-body select,
  .modal-body input {
    max-width: 100%;
    min-width: 0;
  }
  .modal-footer {
    padding: 11px 12px;
  }
  input[type="text"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  input[type="email"],
  select,
  textarea {
    font-size: 16px;
    min-height: 42px;
    max-width: 100%;
  }
  .toolbar-filters input.input-inline,
  .toolbar-filters select.input-inline,
  .toolbar-filters .input-inline {
    width: 100%;
    min-width: 0 !important;
  }
  .line-items-box {
    border: none;
    background: transparent;
    width: 100%;
    overflow: visible;
  }
  .line-items-table {
    display: block;
    width: 100%;
    table-layout: fixed;
  }
  .line-items-table thead {
    display: none;
  }
  .line-items-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }
  .line-items-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 10px;
    padding: 12px;
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(15, 41, 55, 0.05);
  }
  .line-items-table tbody tr:hover {
    background: #ffffff;
  }
  .line-items-table tbody td {
    display: block;
    border: none;
    padding: 0;
    min-width: 0;
    width: 100%;
    text-align: left !important;
  }
  .line-items-table tbody td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.2px;
    margin-bottom: 4px;
  }
  .line-items-table tbody td.li-product {
    grid-column: 1 / -1;
  }
  .line-items-table tbody td.li-qty input,
  .line-items-table tbody td.li-price input,
  .line-items-table tbody td.li-disc input {
    width: 100%;
    min-width: 0;
    font-size: 16px;
    padding: 8px 10px;
    min-height: 44px;
  }
  .line-items-table tbody td.li-qty input {
    text-align: center;
    font-weight: 700;
    border-color: var(--primary);
    background: #f4fbfb;
  }
  .line-items-table tbody td.li-total {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
  }
  .line-items-table tbody td.li-action {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    padding-top: 4px;
    border-top: 1px dashed #e2e8f0;
  }
  .picker-sub {
    max-width: 100%;
  }
  .picker-dropdown {
    min-width: 0;
    max-width: calc(100vw - 16px);
  }
  .topbar-right .btn-sm {
    padding: 5px 8px;
    font-size: 11.5px;
  }
}


/* ---------- Kho (CWI): chon kho va ton theo tung kho ---------- */
.wh-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.wh-chip { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--primary-soft); color: var(--primary-dark); white-space: nowrap; }
.wh-chip.zero { background: #f1f5f9; color: #94a3b8; }
.wh-chip.wh-2 { background: #fef3c7; color: #92400e; }
.wh-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-bottom: 16px; }
.wh-card { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.wh-card.wh-2 { border-left-color: #d97706; }
.wh-card h4 { font-size: 14px; margin-bottom: 8px; }
.wh-card .wh-row { display: flex; justify-content: space-between; font-size: 13px; padding: 2px 0; }
.wh-arrow { font-weight: 700; color: var(--primary); padding: 0 4px; }
