/* =========================================================
   Vinut Sale Order – UI kit
   Màu chủ đạo lấy từ logo: xanh lá #177E3E, đỏ #ED1C24
   ========================================================= */
:root {
  --green-900: #0c4a23;
  --green-800: #105f2f;
  --green-700: #177e3e;   /* logo */
  --green-600: #1f9a4d;
  --green-100: #e3f3e8;
  --green-50:  #f2faf4;
  --red-700:   #c8141b;
  --red-600:   #ed1c24;   /* logo */
  --red-100:   #fde4e5;
  --amber-600: #c27c0e;
  --amber-100: #fdf1db;
  --blue-600:  #1d6fb8;
  --blue-100:  #e2eefa;
  --violet-600:#6b4bb5;
  --violet-100:#eee8fa;

  --ink:       #17211b;
  --ink-2:     #4a5750;
  --ink-3:     #7b8780;
  --line:      #e2e8e4;
  --bg:        #f4f7f5;
  --card:      #ffffff;

  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 1px 2px rgba(16,40,24,.06), 0 4px 14px rgba(16,40,24,.05);
  --sidebar-w: 256px;
  --topbar-h:  60px;
  --font: "Be Vietnam Pro", "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5;
  color: var(--ink); background: var(--bg);
}
a { color: var(--green-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 600; }
img { max-width: 100%; }
.num { font-variant-numeric: tabular-nums; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.text-green { color: var(--green-700); }
.text-red { color: var(--red-600); }
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}
.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}
.hidden { display: none !important; }

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

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  background: var(--green-900);
  background: linear-gradient(180deg, var(--green-800) 0%, var(--green-900) 100%);
  color: #d8eadf; display: flex; flex-direction: column;
  transition: transform .25s ease;
}
.sidebar__brand {
  height: var(--topbar-h); display: flex; align-items: center; gap: 10px;
  padding: 0 18px; background: #fff; border-bottom: 3px solid var(--red-600);
}
.sidebar__brand:hover { text-decoration: none; }
.sidebar__brand img { height: 38px; width: auto; }
.sidebar__brand span { font-size: 12px; color: var(--ink-2); line-height: 1.2; font-weight: 600; }
.sidebar__nav { flex: 1; overflow-y: auto; padding: 10px 10px 24px; }
.nav-group { margin-top: 14px; }
.nav-group__title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: #8fbb9e; padding: 0 10px 6px; font-weight: 600;
}
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: var(--radius-sm); color: #d8eadf; font-size: 13.5px;
}
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav-link.active { background: #fff; color: var(--green-800); font-weight: 600; }
.nav-link.active .ico { color: var(--red-600); }
.nav-link .badge { margin-left: auto; }
.ico { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }

.sidebar__foot { padding: 12px 18px; font-size: 12px; color: #8fbb9e; border-top: 1px solid rgba(255,255,255,.08); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 22px;
}
.topbar__title { font-size: 16px; font-weight: 600; }
.topbar__spacer { flex: 1; }
.topbar__search { position: relative; width: 280px; }
.topbar__search input { padding-left: 34px; background: var(--bg); border-color: transparent; }
.topbar__search .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: 10px; border: 0;
  background: transparent; color: var(--ink-2); display: inline-grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { background: var(--bg); }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--red-600); border: 2px solid #fff; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 24px; cursor: pointer; }
.user-chip:hover { background: var(--bg); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--green-100); color: var(--green-800); font-weight: 700; font-size: 13px; flex: none;
}
.avatar--red { background: var(--red-100); color: var(--red-700); }
.user-chip__name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.user-chip__role { font-size: 11.5px; color: var(--ink-3); }

.content { padding: 22px 28px; width: 100%; max-width: 2200px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb { font-size: 12.5px; color: var(--ink-3); margin-bottom: 4px; }
.breadcrumb a { color: var(--ink-3); }

.backdrop { display: none; }

/* ---------- Card ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card__head h2, .card__head h3 { font-size: 15px; }
.card__body { padding: 18px; }
.card__foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-main-side { grid-template-columns: minmax(0,2fr) minmax(0,1fr); }
.grid-side-main { grid-template-columns: minmax(0,1fr) minmax(0,2.4fr); }

/* ---------- Stat tiles ---------- */
.stat { padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; }
.stat__icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--green-100); color: var(--green-700); }
.stat__icon--red { background: var(--red-100); color: var(--red-600); }
.stat__icon--amber { background: var(--amber-100); color: var(--amber-600); }
.stat__icon--blue { background: var(--blue-100); color: var(--blue-600); }
.stat__icon--gold { background: #fdf1cf; color: #b38200; }
.stat__icon--silver { background: #e9edf1; color: #5d6b79; }
.stat__icon--bronze { background: #f6e3d3; color: #a5571f; }
.stat__icon--violet { background: var(--violet-100); color: var(--violet-600); }
.stat__label { font-size: 12.5px; color: var(--ink-3); }
.stat__value { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat__sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.trend-up { color: var(--green-700); font-weight: 600; }
.trend-down { color: var(--red-600); font-weight: 600; }

.hero {
  border-radius: var(--radius); padding: 20px 22px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(120deg, var(--green-700), var(--green-900));
}
.hero::after { content: ""; position: absolute; right: -60px; bottom: -90px; width: 260px; height: 260px; border-radius: 50%; border: 28px solid rgba(237,28,36,.35); }
.hero h2 { font-size: 18px; }
.hero p { margin: 4px 0 0; opacity: .85; }
.hero__value { font-size: 30px; font-weight: 700; margin-top: 10px; font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.hero .btn { position: relative; z-index: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  background: #fff; color: var(--ink); border-color: var(--line); text-decoration: none !important;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.btn-primary:hover { background: var(--green-800); }
.btn-danger { background: var(--red-600); border-color: var(--red-600); color: #fff; }
.btn-danger:hover { background: var(--red-700); }
.btn-outline { border-color: var(--green-700); color: var(--green-700); }
.btn-outline:hover { background: var(--green-50); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-light { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.35); color: #fff; }
.btn-light:hover { background: rgba(255,255,255,.25); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(2, minmax(0,1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.col-span-2 { grid-column: span 2; }
.col-span-full { grid-column: 1 / -1; }
.field label, .label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field .req { color: var(--red-600); }
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.field .error { font-size: 12px; color: var(--red-600); margin-top: 4px; }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; color: var(--ink); background: #fff;
}
.textarea { height: auto; min-height: 80px; padding: 9px 11px; resize: vertical; }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237b8780' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(23,126,62,.15); }
.input.is-invalid { border-color: var(--red-600); }
.input[readonly] { background: var(--bg); }
.input-group { display: flex; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .addon { display: grid; place-items: center; padding: 0 11px; border: 1px solid var(--line); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--bg); color: var(--ink-3); font-size: 13px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.check input { width: 17px; height: 17px; accent-color: var(--green-700); margin: 0; }
.radio-cards { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.radio-card { position: relative; border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px 12px 40px; cursor: pointer; }
.radio-card input { position: absolute; left: 14px; top: 15px; accent-color: var(--green-700); width: 16px; height: 16px; }
.radio-card strong { display: block; font-size: 13.5px; }
.radio-card span { font-size: 12px; color: var(--ink-3); }
.radio-card:has(input:checked) { border-color: var(--green-700); background: var(--green-50); }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cbd5ce; border-radius: 22px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--green-700); }
.switch input:checked + span::before { transform: translateX(16px); }

/* ---------- Filter bar ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); align-items: flex-end; }
.filters .field { min-width: 150px; flex: 1 1 150px; }
.filters .field--search { flex: 2 1 220px; }
.filters .filters__actions { display: flex; gap: 8px; }

.tabs { display: flex; gap: 4px; padding: 0 18px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 12px 10px; font-weight: 600; font-size: 13.5px; color: var(--ink-3); border-bottom: 2.5px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.active { color: var(--green-700); border-bottom-color: var(--green-700); }
.tab .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 10px; background: var(--bg); font-size: 11.5px; text-align: center; }
.tab.active .count { background: var(--green-100); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 5px 12px; border-radius: 20px; border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: #fff; cursor: pointer; }
.chip.active { background: var(--green-700); color: #fff; border-color: var(--green-700); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--bg); color: var(--ink-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge--plain::before { display: none; }
.badge--green { background: var(--green-100); color: var(--green-800); }
.badge--red { background: var(--red-100); color: var(--red-700); }
.badge--amber { background: var(--amber-100); color: var(--amber-600); }
.badge--blue { background: var(--blue-100); color: var(--blue-600); }
.badge--violet { background: var(--violet-100); color: var(--violet-600); }
.badge--gold { background: #fdf1cf; color: #8a6200; }
.badge--silver { background: #e9edf1; color: #4f5d6b; }
.badge--bronze { background: #f6e3d3; color: #8c4a1c; }
.badge--gray, .badge--muted { background: #edf0ee; color: var(--ink-3); }
.badge--count { background: var(--red-600); color: #fff; padding: 0 7px; font-size: 11px; }
.badge--count::before { display: none; }

/* ---------- Data table → card view on mobile ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em;
  padding: 10px 14px; background: #f8faf9; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: var(--green-50); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .col-check { width: 40px; }
.table .col-actions { text-align: right; white-space: nowrap; }
.table tr.is-disabled td { color: var(--ink-3); background: #fafbfa; }
.table tr.is-selected td { background: var(--green-50); }
.table tr.is-warn td { background: #fff8f0; }
.table tr.is-error td { background: #fff4f4; }
.table tfoot td { font-weight: 700; background: #f8faf9; border-top: 1px solid var(--line); }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--ink-3); }
.table input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--green-700); }

/* ---------- Pagination ---------- */
.pager { display: flex; gap: 4px; align-items: center; }
.pager a, .pager span { min-width: 32px; height: 32px; display: grid; place-items: center; border-radius: 7px; font-size: 13px; color: var(--ink-2); padding: 0 6px; }
.pager a:hover { background: var(--bg); text-decoration: none; }
.pager .active { background: var(--green-700); color: #fff; font-weight: 600; }

/* ---------- Alerts ---------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.45;
  border: 1px solid transparent;
}
.alert .ico, .alert .alert__icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}
.alert--info { background: var(--blue-100); border-color: #c5dcf2; color: #154f85; }
.alert--success { background: var(--green-100); border-color: #bfe2ca; color: var(--green-900); }
.alert--warn { background: var(--amber-100); border-color: #f2d9a8; color: #7a4d06; }
.alert--danger, .alert--error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}
.alert--danger .alert__icon, .alert--error .alert__icon,
.alert--danger .ico, .alert--error .ico {
  color: #dc2626;
}

/* ---------- Lists, timeline, progress ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list__main { flex: 1; min-width: 0; }
.list__title { font-weight: 600; }
.list__sub { font-size: 12px; color: var(--ink-3); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.kv .total { border-top: 1px dashed var(--line); padding-top: 8px; font-size: 15px; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--line); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--ink-3); }
.timeline li.done::before { background: var(--green-700); border-color: var(--green-700); }
.timeline li.current::before { background: var(--red-600); border-color: var(--red-600); box-shadow: 0 0 0 4px var(--red-100); }
.timeline .t-title { font-weight: 600; }
.timeline .t-meta { font-size: 12px; color: var(--ink-3); }

.progress { height: 8px; border-radius: 8px; background: #e7ece9; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--green-600), var(--green-700)); border-radius: 8px; }
.progress--red > span { background: var(--red-600); }

.steps { display: flex; gap: 0; counter-reset: s; }
.steps li { flex: 1; list-style: none; text-align: center; font-size: 12px; color: var(--ink-3); position: relative; }
.steps li::before { counter-increment: s; content: counter(s); display: grid; place-items: center; width: 26px; height: 26px; margin: 0 auto 4px; border-radius: 50%; background: #e7ece9; font-weight: 700; position: relative; z-index: 1; }
.steps li::after { content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 2px; background: #e7ece9; }
.steps li:first-child::after { display: none; }
.steps li.done::before, .steps li.done::after, .steps li.current::after { background: var(--green-700); color: #fff; }
.steps li.current::before { background: var(--red-600); color: #fff; }
.steps li.done, .steps li.current { color: var(--ink); font-weight: 600; }

/* ---------- Bar chart (pure CSS) ---------- */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding-top: 10px; }
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars__stack { width: 100%; max-width: 34px; display: flex; flex-direction: column-reverse; border-radius: 6px 6px 0 0; overflow: hidden; }
.bars__stack span { display: block; }
.bars__stack .a { background: var(--green-700); }
.bars__stack .b { background: var(--red-600); }
.bars__label { font-size: 11.5px; color: var(--ink-3); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.donut { width: 140px; height: 140px; border-radius: 50%; position: relative; flex: none; }
.donut::after { content: ""; position: absolute; inset: 22px; background: #fff; border-radius: 50%; }
.donut__center { position: absolute; inset: 0; display: grid; place-items: center; z-index: 1; text-align: center; font-size: 12px; color: var(--ink-3); }
.donut__center b { display: block; font-size: 20px; color: var(--ink); }

/* ---------- Sticky action bar ---------- */
.sticky-bar {
  position: sticky; bottom: 0; z-index: 20; margin-top: 16px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 -4px 18px rgba(16,40,24,.08);
  padding: 12px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.sticky-bar__info { flex: 1; min-width: 200px; }
.sticky-bar__total { font-size: 18px; font-weight: 700; color: var(--green-700); }

/* ---------- Modal / Drawer ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(12,30,18,.45); }
.modal.open { display: flex; }
.modal__dialog { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.modal__dialog > form { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.modal__dialog--lg { max-width: 820px; }
.modal__head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.modal__head h3 { font-size: 16px; }
.modal__body { padding: 20px; overflow-y: auto; flex: 1; min-height: 0; }
.modal__foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0; background: #fff; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty .ico { width: 40px; height: 40px; color: #b8c6bd; margin-bottom: 8px; }

/* ---------- Order line editor ---------- */
.line-item { display: grid; grid-template-columns: minmax(0,3fr) 110px 140px 140px 40px; gap: 10px; align-items: end; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.line-item:last-child { border-bottom: 0; }
.line-item .amount { height: 38px; display: flex; align-items: center; justify-content: flex-end; font-weight: 700; }

/* ---------- Login & Auth ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  background: var(--bg);
}
.auth__brand {
  position: relative;
  overflow: hidden;
  color: #fff;
  padding: 56px 48px;
  background: linear-gradient(145deg, #105f2f 0%, #0c4a23 50%, #083318 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.auth__brand::before {
  content: "";
  position: absolute;
  width: 540px;
  height: 540px;
  border-radius: 50%;
  right: -160px;
  bottom: -200px;
  border: 55px solid rgba(237, 28, 36, 0.22);
  pointer-events: none;
}
.auth__brand::after {
  content: "";
  position: absolute;
  width: 760px;
  height: 760px;
  border-radius: 50%;
  right: -240px;
  bottom: -280px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
}
.auth__logo {
  align-self: flex-start;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  padding: 12px 18px;
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  position: relative;
  z-index: 1;
}
.auth__logo img {
  height: 48px;
  width: auto;
  display: block;
}
.auth__brand-body {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 36px 0;
}
.auth__brand h1 {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 14px;
  color: #ffffff;
  letter-spacing: -0.01em;
}
.auth__brand p {
  opacity: 0.9;
  font-size: 15px;
  line-height: 1.6;
  color: #e3f3e8;
  margin-bottom: 28px;
}
.auth__features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}
.auth__features li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: #f2faf4;
}
.auth__feature-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #bbf7d0;
}
.auth__brand-foot {
  font-size: 12.5px;
  color: rgba(216, 234, 223, 0.7);
  position: relative;
  z-index: 1;
}

.auth__form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: #f8faf9;
}
.auth__box {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  padding: 40px 36px;
  border-radius: 16px;
  border: 1px solid rgba(226, 232, 228, 0.85);
  box-shadow: 0 10px 25px -5px rgba(16, 40, 24, 0.07), 0 8px 10px -6px rgba(16, 40, 24, 0.04);
}
.auth__box h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.auth__box .lead {
  color: var(--ink-3);
  font-size: 14px;
  margin: 0 0 22px 0;
}
.auth__mobile-logo {
  display: none;
  text-align: center;
  margin-bottom: 24px;
}
.auth__mobile-logo img {
  height: 52px;
  width: auto;
}
.auth__box .alert {
  margin-bottom: 20px;
}
.auth__box .field {
  margin-bottom: 18px;
}
.auth__box .field label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
  display: block;
}
.auth__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.auth__input-icon {
  position: absolute;
  left: 14px;
  color: #94a3b8;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth__box .input {
  height: 44px;
  padding: 0 14px 0 42px;
  font-size: 14px;
  border-radius: 10px;
  border: 1.5px solid #d1d5db;
  transition: all 0.2s ease;
  background: #ffffff;
}
.auth__box .input:focus {
  border-color: var(--green-600);
  box-shadow: 0 0 0 3.5px rgba(23, 126, 62, 0.12);
  outline: none;
}
.auth__box .pw-wrap .input {
  padding-right: 46px;
}
.auth__pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.auth__pw-toggle:hover {
  color: var(--green-700);
  background: #f1f5f9;
}
.auth__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 24px 0;
}
.auth__box .check {
  font-size: 13.5px;
  color: var(--ink-2);
  user-select: none;
}
.auth__box .check input {
  width: 17px;
  height: 17px;
  accent-color: var(--green-700);
  border-radius: 4px;
}
.auth__box .btn-submit {
  height: 46px;
  background: linear-gradient(135deg, var(--green-700) 0%, var(--green-800) 100%);
  border: none;
  border-radius: 10px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 12px rgba(23, 126, 62, 0.25);
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}
.auth__box .btn-submit:hover {
  background: linear-gradient(135deg, var(--green-600) 0%, var(--green-700) 100%);
  box-shadow: 0 6px 16px rgba(23, 126, 62, 0.35);
  transform: translateY(-1px);
}
.auth__box .btn-submit:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(23, 126, 62, 0.2);
}
.auth__hint {
  font-size: 12.5px;
  color: var(--ink-3);
  text-align: center;
  margin-top: 20px;
  line-height: 1.5;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .topbar__search { width: 200px; }
}

@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); box-shadow: 4px 0 24px rgba(0,0,0,.2); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(12,30,18,.45); }
  .main { margin-left: 0; }
  .topbar__toggle { display: inline-grid; }
  .topbar__search { display: none; }
  .grid-main-side, .grid-side-main, .grid-3 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; background: #f8faf9; }
  .auth__brand { display: none; }
  .auth__form { padding: 24px 16px; background: transparent; }
  .auth__box { padding: 32px 24px; box-shadow: 0 4px 16px rgba(16, 40, 24, 0.06); }
  .auth__mobile-logo { display: block; margin-bottom: 24px; text-align: center; }
  .auth__mobile-logo img { height: 52px; width: auto; }
}

@media (max-width: 768px) {
  body { font-size: 14px; }
  .content { padding: 14px; }
  .topbar { padding: 0 12px; gap: 6px; }
  .user-chip__text { display: none; }
  .page-head h1 { font-size: 19px; }
  .page-head__actions { width: 100%; }
  .page-head__actions .btn { flex: 1; }
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .grid-4.stats-compact { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .stats-compact .stat { flex-direction: column; gap: 8px; padding: 14px; }
  .stats-compact .stat__value { font-size: 19px; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: auto; }
  .radio-cards { grid-template-columns: 1fr; }
  .filters { padding: 12px 14px; }
  .filters .field { flex: 1 1 100%; }
  .filters .field:has(input[type=date]) { flex: 1 1 40%; min-width: 0; }
  .filters .filters__actions { width: 100%; }
  .filters .filters__actions .btn { flex: 1; }
  .card__body { padding: 14px; }
  .card__head, .card__foot { padding: 12px 14px; }
  .tabs { padding: 0 8px; }

  /* ---- TABLE → CARD VIEW ---- */
  .table-wrap { overflow: visible; }
  .table--cards, .table--cards tbody, .table--cards tr, .table--cards td, .table--cards tfoot { display: block; width: 100%; }
  .table--cards thead { display: none; }
  .table--cards tbody { padding: 10px; background: var(--bg); }
  .table--cards tr {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    margin-bottom: 10px; padding: 10px 14px 10px; position: relative; box-shadow: var(--shadow);
  }
  .table--cards tbody tr:hover { background: #fff; }
  .table--cards tr.is-selected { border-color: var(--green-700); background: var(--green-50); }
  .table--cards tr.is-disabled { background: #fafbfa; }
  .table--cards tr.is-warn { border-left: 4px solid var(--amber-600); }
  .table--cards tr.is-error { border-left: 4px solid var(--red-600); }
  .table--cards tr.is-warn td, .table--cards tr.is-error td, .table--cards tr.is-selected td, .table--cards tr.is-disabled td { background: transparent; }
  .table--cards td {
    border: 0; padding: 5px 0; display: flex; justify-content: space-between; align-items: center; gap: 14px; text-align: right;
  }
  .table--cards td::before {
    content: attr(data-label); font-size: 12px; color: var(--ink-3); font-weight: 600; text-align: left; flex: none; max-width: 45%;
  }
  .table--cards td[data-label=""]::before, .table--cards td:not([data-label])::before { display: none; }
  /* ô tiêu đề card: không nhãn, căn trái, chữ to */
  .table--cards td > .td-v { min-width: 0; }
  .table--cards .badge { white-space: normal; text-align: left; }
  .table--cards td.card-title { display: block; text-align: left; padding: 0 0 8px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
  .table--cards td.card-title::before { display: none; }
  .table--cards td.card-title .cell-main { font-size: 15px; }
  .table--cards tr:has(td.col-check) td.card-title { padding-left: 30px; }
  .table--cards td.col-check { position: absolute; top: 12px; left: 14px; width: auto; padding: 0; z-index: 1; }
  .table--cards td.col-check::before { display: none; }
  .table--cards td.col-actions { justify-content: flex-end; gap: 8px; padding-top: 10px; margin-top: 6px; border-top: 1px solid var(--line); flex-wrap: wrap; }
  .table--cards td.col-actions::before { display: none; }
  .table--cards td.col-actions .btn { flex: 1; }
  .table--cards td.hide-mobile { display: none; }
  .table--cards tfoot { background: var(--green-50); padding: 12px 14px; }
  .table--cards tfoot tr { background: transparent; border: 0; box-shadow: none; padding: 0; margin: 0; display: block; }
  .table--cards tfoot td { background: transparent; }

  .line-item { grid-template-columns: 1fr 1fr; background: var(--bg); border: 0; border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; }
  .line-item > :first-child { grid-column: 1 / -1; }
  .line-item .amount { justify-content: flex-start; }

  .sticky-bar { border-radius: 14px 14px 0 0; margin: 16px -14px -14px; position: sticky; }
  .sticky-bar .btn { flex: 1; }
  .modal { padding: 0; align-items: flex-end; }
  .modal__dialog { border-radius: 16px 16px 0 0; max-height: 94vh; }
  .modal__foot .btn { flex: 1; }
  .card__foot .pager { width: 100%; justify-content: center; }
  .bars { gap: 5px; }

  /* =========================================================
     Màn hình Nhân viên Kinh doanh (Sale) Responsive Mobile
     ========================================================= */

  /* 1. Ngăn chặn iOS tự động phóng to màn hình khi click vào input */
  .input, select.input, .select, textarea.input, .autocomplete__input {
    font-size: 16px !important;
  }

  /* 2. Touch targets trên mobile */
  .btn {
    min-height: 40px;
  }
  .input, select.input, .select {
    min-height: 42px;
  }

  /* 3. Tiêu đề trang & nút tác vụ */
  .page-head {
    flex-wrap: wrap;
    gap: 10px;
  }
  .page-head__actions {
    width: 100%;
    display: flex;
    gap: 8px;
  }
  .page-head__actions .btn {
    flex: 1;
    width: 100%;
  }

  /* 4. Màn hình Việc của tôi (/sale/my-work) */
  .hero {
    padding: 16px 14px;
  }
  .hero h2 {
    font-size: 16px;
  }
  .hero__value {
    font-size: 26px;
    margin-top: 6px;
  }
  .hero__actions {
    flex-direction: column;
    align-items: stretch !important;
  }
  .hero__actions .btn {
    width: 100%;
    justify-content: center;
  }
  .stats-compact .stat {
    padding: 12px;
  }
  .stats-compact .stat__value {
    font-size: 18px;
  }
  .list li {
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 8px 10px;
  }
  .list__main {
    flex: 1 1 calc(100% - 48px);
    min-width: 0;
  }
  .list li > .badge,
  .list li > b.num {
    margin-left: auto;
  }

  /* 5. Màn hình Tạo đơn hàng (/orders/create) */
  .card--products {
    min-height: auto;
  }
  .card--products .card__body {
    min-height: auto !important;
    padding: 12px 10px;
  }
  .order-lines-wrap {
    min-height: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }
  .order-lines-table {
    min-width: 580px;
  }
  .order-lines-table th,
  .order-lines-table td {
    padding: 8px 6px;
  }
  .order-lines-table .prod-col {
    min-width: 220px;
  }
  .order-lines-table .autocomplete__dropdown {
    min-width: 260px;
    max-width: calc(100vw - 32px);
  }
  .order-lines-summary {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 12px;
    padding: 12px;
  }
  .order-lines-summary .sum-figures {
    justify-content: space-between;
    width: 100%;
    gap: 10px;
  }
  .order-lines-summary .btn {
    width: 100%;
    justify-content: center;
  }
  .radio-cards {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* 6. Màn hình Đơn hàng của tôi (/orders) */
  .orders-filter-form {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }
  .orders-filter-form .btn {
    width: 100%;
    justify-content: center;
  }

  /* 7. Màn hình Hoa hồng của tôi (/sale/commissions) */
  .tabs {
    padding: 0 8px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar {
    display: none;
  }
  .table--cards td[data-label="Trạng thái chi"] .badge {
    white-space: normal;
    text-align: right;
    line-height: 1.3;
  }

  /* 8. Màn hình Người nhận hàng (/customers) */
  #quick-check-form {
    grid-template-columns: 1fr !important;
  }
  #quick-check-form .btn {
    width: 100%;
  }
  .customer-search-form {
    width: 100% !important;
    display: flex;
    gap: 8px;
  }
  .customer-search-form .input {
    width: 100% !important;
    flex: 1;
  }

  /* 9. Chi tiết đơn hàng (/orders/detail) */
  .order-delivery-card .card__body {
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px;
  }
  .order-delivery-card form,
  .order-delivery-card .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .content {
    padding: 10px;
  }
  .grid-4.stats-compact {
    grid-template-columns: 1fr;
  }
  .stats-compact .stat {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
  .topbar {
    height: 52px;
    padding: 0 10px;
  }
  .table--cards tr {
    padding: 10px 12px;
  }
  .table--cards td {
    font-size: 13.5px;
  }
}

@media print {
  .sidebar, .topbar, .no-print, .sticky-bar { display: none !important; }
  .main { margin: 0; }
  .card { box-shadow: none; }
  body { background: #fff; }
}

/* ---------- User menu (dropdown) ---------- */
.user-menu { position: relative; }
.user-menu > summary { list-style: none; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu__pop {
  position: absolute; right: 0; top: calc(100% + 8px); width: 250px; z-index: 50;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(16,40,24,.14); padding: 6px;
}
.user-menu__head { display: flex; gap: 10px; align-items: center; padding: 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.user-menu__pop a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; color: var(--ink); font-size: 13.5px; }
.user-menu__pop a:hover { background: var(--bg); text-decoration: none; }
.user-menu__pop a.text-red { color: var(--red-600); border-top: 1px solid var(--line); margin-top: 4px; }

/* ---------- Profile ---------- */
.avatar--xl { width: 84px; height: 84px; font-size: 28px; border: 4px solid #fff; box-shadow: var(--shadow); margin: -48px auto 10px; }
.profile-card { overflow: hidden; }
.profile-card__cover { height: 84px; background: linear-gradient(120deg, var(--green-700), var(--green-900)); position: relative; }
.profile-card__cover { overflow: hidden; }
.profile-card__cover::after { content: ""; position: absolute; right: -30px; top: -50px; width: 120px; height: 120px; border-radius: 50%; border: 14px solid rgba(237,28,36,.45); }
.profile-card__body { padding: 0 18px 18px; text-align: center; position: relative; }
.profile-card__body h2 { font-size: 18px; }

.pw-field { position: relative; }
.pw-field .input { padding-right: 44px; }
.pw-field .icon-btn { position: absolute; right: 0; top: 0; height: 38px; }
.pw-meter { display: grid; grid-template-columns: repeat(4,1fr); gap: 4px; margin-top: 8px; }
.pw-meter span { height: 5px; border-radius: 4px; background: #e2e8e4; }
.pw-meter[data-level="1"] span:nth-child(-n+1) { background: var(--red-600); }
.pw-meter[data-level="2"] span:nth-child(-n+2) { background: var(--amber-600); }
.pw-meter[data-level="3"] span:nth-child(-n+3) { background: var(--green-600); }
.pw-meter[data-level="4"] span { background: var(--green-700); }
.pw-rules { list-style: none; padding: 0; margin: 8px 0 0; font-size: 12.5px; color: var(--ink-3); display: grid; gap: 3px; }
.pw-rules li::before { content: "○"; margin-right: 6px; }
.pw-rules li.ok { color: var(--green-700); }
.pw-rules li.ok::before { content: "✓"; font-weight: 700; }

/* ---------- Rank (Đồng / Bạc / Vàng) ---------- */
.rank-tier--bronze { --tier: #a5571f; --tier-bg: #f6e3d3; }
.rank-tier--silver { --tier: #5d6b79; --tier-bg: #e9edf1; }
.rank-tier--gold   { --tier: #b38200; --tier-bg: #fdf1cf; }
.rank-ladder { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.rank-tier { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 18px 14px; text-align: center; position: relative; }
.rank-tier__medal { width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 8px; display: grid; place-items: center; background: var(--tier-bg); color: var(--tier); }
.rank-tier__medal .ico { width: 28px; height: 28px; }
.rank-hero__medal .ico { width: 42px; height: 42px; }
.rank-tier__name { font-weight: 700; font-size: 16px; color: var(--tier); }
.rank-tier__rate { font-size: 24px; font-weight: 700; margin-top: 2px; }
.rank-tier__rate small { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.rank-tier__kpi { font-size: 12.5px; color: var(--ink-3); }
.rank-tier.is-current { border-color: var(--tier); background: linear-gradient(180deg, var(--tier-bg), #fff 70%); box-shadow: var(--shadow); }
.rank-hero { display: flex; gap: 20px; padding: 20px; align-items: flex-start; }
.rank-hero__medal { width: 84px; height: 84px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--tier-bg); color: var(--tier); box-shadow: inset 0 0 0 4px #fff, 0 0 0 2px var(--tier); }
.rank-hero__main { flex: 1; min-width: 0; }
.rank-hero__main h2 { font-size: 24px; color: var(--tier, inherit); }
.rank-hero__progress { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; margin-top: 12px; max-width: 640px; }

@media (max-width: 768px) {
  .user-menu__pop { position: fixed; left: 8px; right: 8px; top: 60px; width: auto; }
  .rank-ladder { grid-template-columns: 1fr; }
  .rank-tier { display: grid; grid-template-columns: 56px 1fr auto; text-align: left; gap: 0 12px; align-items: center; padding: 12px 14px; }
  .rank-tier__medal { grid-row: span 3; margin: 0; }
  .rank-tier .badge { grid-column: 3; grid-row: 1 / span 3; margin: 0; }
  .rank-tier__rate { font-size: 18px; }
  .rank-hero { flex-direction: column; align-items: center; text-align: center; padding: 16px; }
  .rank-hero__progress { grid-template-columns: 1fr; text-align: left; }
  .rank-hero .alert { text-align: left; }
}

/* ---------- Ẩn thanh cuộn menu trái (vẫn cuộn được bằng chuột/cảm ứng) ---------- */
.sidebar__nav { scrollbar-width: none; -ms-overflow-style: none; overscroll-behavior: contain; }
.sidebar__nav::-webkit-scrollbar { width: 0; height: 0; display: none; }
/* Hiện thanh cuộn mảnh, cùng tông xanh khi rê chuột vào menu */
@media (hover: hover) {
  .sidebar__nav:hover { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; }
  .sidebar__nav:hover::-webkit-scrollbar { display: block; width: 6px; }
  .sidebar__nav:hover::-webkit-scrollbar-thumb { background: rgba(255,255,255,.25); border-radius: 6px; }
  .sidebar__nav:hover::-webkit-scrollbar-track { background: transparent; }
}

/* ---------- Nút menu: desktop = thu gọn menu trái, mobile = mở menu trượt ---------- */
.topbar__toggle { display: inline-grid; margin-left: -6px; }
.main { transition: margin-left .2s ease; }
.sidebar { transition: transform .25s ease, width .2s ease; }

@media (min-width: 993px) {
  body.sidebar-mini { --sidebar-w: 72px; }
  body.sidebar-mini .sidebar__brand { padding: 0; justify-content: center; }
  body.sidebar-mini .sidebar__brand img { height: 24px; }
  body.sidebar-mini .sidebar__brand span,
  body.sidebar-mini .nav-link > span:not(.badge),
  body.sidebar-mini .sidebar__foot { display: none; }
  body.sidebar-mini .sidebar__nav { padding: 10px 8px 24px; }
  body.sidebar-mini .nav-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.1); }
  body.sidebar-mini .nav-group:first-child { border-top: 0; padding-top: 0; }
  body.sidebar-mini .nav-group__title { display: none; }
  body.sidebar-mini .nav-link { justify-content: center; padding: 10px 0; position: relative; }
  body.sidebar-mini .nav-link .ico { width: 20px; height: 20px; }
  body.sidebar-mini .nav-link .badge { position: absolute; top: 3px; right: 6px; margin: 0; padding: 0 5px; font-size: 10px; line-height: 16px; }
}

/* Số tiền không xuống dòng giữa số và ký hiệu ₫ */
.table td.num, .table td .num, .kv dd.num { white-space: nowrap; }

/* Mã giới thiệu trên hồ sơ */
.referral-box { border: 1.5px dashed var(--green-600); border-radius: var(--radius-sm); padding: 12px; background: var(--green-50); }
.referral-box__code { font-size: 24px; font-weight: 700; letter-spacing: .12em; color: var(--green-800); margin: 2px 0 8px; font-variant-numeric: tabular-nums; }
.input-group .addon { white-space: nowrap; }

/* ---------- Autocomplete (tỉnh/thành & xã/phường) ---------- */
.autocomplete {
  position: relative;
  width: 100%;
}
.autocomplete.is-open {
  z-index: 150;
}
.autocomplete__input {
  width: 100%;
  padding-right: 32px;
}
.autocomplete__clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--ink-3);
  cursor: pointer;
  padding: 4px;
  font-size: 13px;
  line-height: 1;
  display: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  text-align: center;
}
.autocomplete__clear:hover {
  background: #f0f3f1;
  color: var(--red-600);
}
.autocomplete.has-value .autocomplete__clear {
  display: block;
}
.autocomplete__dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(16,40,24,.12);
  z-index: 100;
  list-style: none;
  margin: 0;
  padding: 4px 0;
}
.autocomplete__item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--ink);
  transition: background .15s;
}
.autocomplete__item:hover,
.autocomplete__item.is-active {
  background: var(--green-50);
  color: var(--green-800);
  font-weight: 500;
}
.autocomplete__item mark {
  background: transparent;
  color: var(--green-700);
  font-weight: 700;
}
.autocomplete__empty,
.autocomplete__loading {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--ink-3);
  text-align: center;
}

/* Autocomplete hiển thị sản phẩm phong phú */
.autocomplete__item-prod {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.autocomplete__item-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13.5px;
}
.autocomplete__item-code {
  font-family: var(--font-mono, monospace);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--green-700);
  background: var(--green-50);
  border: 1px solid var(--green-200, #bbf7d0);
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
}
.autocomplete__item-name {
  color: var(--ink);
  font-weight: 500;
  line-height: 1.35;
}
.autocomplete__item-sub {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 1px;
}
.autocomplete__item-sub .price-tag {
  color: var(--green-800);
  font-weight: 600;
}
.autocomplete__item-sub .unit-tag {
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--ink-2);
}

/* Bảng hàng hóa lên đơn & dropdown sản phẩm */
.card--products {
  position: relative;
  z-index: 30;
  min-height: 480px;
}
.card--products .card__body {
  min-height: 380px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: visible;
}
.order-lines-wrap {
  min-height: 280px;
  overflow: visible;
  position: relative;
}
@media (max-width: 900px) {
  .order-lines-wrap {
    overflow-x: auto;
  }
}
.order-lines-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  position: relative;
}
.order-lines-table tr.is-active-row,
.order-lines-table tr:focus-within,
.order-lines-table tr:has(.is-open) {
  position: relative;
  z-index: 1000 !important;
}
.order-lines-table td .autocomplete.is-open {
  position: relative;
  z-index: 1001 !important;
}
.order-lines-table .autocomplete__dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 440px;
  max-width: 100%;
  max-height: 300px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid var(--line, #cbd5e1);
  border-radius: var(--radius-sm, 6px);
  box-shadow: 0 14px 34px rgba(16, 40, 24, 0.22), 0 3px 10px rgba(0, 0, 0, 0.08);
  z-index: 9999 !important;
}
.order-lines-table th {
  background: #f8fafc;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.order-lines-table td {
  padding: 8px 10px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
}
.order-lines-table .stt-col {
  width: 44px;
  text-align: center;
  font-weight: 600;
  color: var(--ink-3);
}
.order-lines-table .prod-col {
  min-width: 260px;
}
.order-lines-table .unit-col {
  width: 90px;
  text-align: center;
}
.order-lines-table .price-col {
  width: 120px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.order-lines-table .qty-col {
  width: 100px;
}
.order-lines-table .amount-col {
  width: 130px;
  text-align: right;
  font-weight: 700;
  color: var(--green-800);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.order-lines-table .action-col {
  width: 44px;
  text-align: center;
}
.btn-del-line {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-3);
  font-size: 14px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.btn-del-line:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}
.order-lines-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  margin-top: 12px;
}
.order-lines-summary .sum-figures {
  display: flex;
  gap: 20px;
  align-items: center;
}
.order-lines-summary .sum-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.order-lines-summary .sum-label {
  font-size: 12px;
  color: var(--ink-3);
  text-transform: uppercase;
}
.order-lines-summary .sum-value {
  font-size: 17px;
  font-weight: 700;
  color: var(--green-800);
  font-variant-numeric: tabular-nums;
}


