/* Sổ bán hàng — giao diện quản lý đơn */
:root {
  --ink: #1B2550;
  --ink-2: #26326a;
  --ink-text: #c9cfe8;
  --bg: #F5F6FA;
  --surface: #FFFFFF;
  --surface-2: #EEF0F6;
  --line: #DFE2EC;
  --text: #182033;
  --muted: #5F6782;
  --jade: #0E8F6E;
  --jade-soft: #DDF3EC;
  --amber: #A06A0C;
  --amber-soft: #FBEFD6;
  --blue: #2F5BD3;
  --blue-soft: #E3EAFC;
  --violet: #6C4BC6;
  --violet-soft: #ECE6FB;
  --red: #C8402F;
  --red-soft: #FBE3DF;
  --focus: #2F5BD3;
  --radius-s: 6px;
  --radius: 10px;
  --radius-l: 16px;
  --shadow: 0 1px 2px rgba(24, 32, 51, .06), 0 4px 16px rgba(24, 32, 51, .05);
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10142A; --surface: #181D38; --surface-2: #20264A; --line: #2C3360; --text: #E8EBF7; --muted: #9AA2C4;
    --ink: #0B0F22; --ink-2: #1A2045;
    --jade: #35C79E; --jade-soft: #123A33; --amber: #E6B24F; --amber-soft: #3B2F14; --blue: #7C9BFF; --blue-soft: #1D2A55;
    --violet: #A98EF5; --violet-soft: #2B2350; --red: #F07562; --red-soft: #45201C; --focus: #7C9BFF;
    --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #10142A; --surface: #181D38; --surface-2: #20264A; --line: #2C3360; --text: #E8EBF7; --muted: #9AA2C4;
  --ink: #0B0F22; --ink-2: #1A2045;
  --jade: #35C79E; --jade-soft: #123A33; --amber: #E6B24F; --amber-soft: #3B2F14; --blue: #7C9BFF; --blue-soft: #1D2A55;
  --violet: #A98EF5; --violet-soft: #2B2350; --red: #F07562; --red-soft: #45201C; --focus: #7C9BFF;
  --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 600; }
h3 { font-size: .95rem; font-weight: 600; }
.with-icon { display: flex; align-items: center; gap: 8px; }
.with-icon svg { width: 20px; height: 20px; flex: none; }
p { margin: 0; }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Khung ứng dụng ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: var(--ink-text); padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; padding: 4px 10px 22px; font-size: 1.02rem; }
.brand small { display: block; font-weight: 400; color: var(--ink-text); font-size: .78rem; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius); color: var(--ink-text); text-decoration: none; font-weight: 500; }
.nav-link svg { width: 20px; height: 20px; flex: none; }
.nav-link:hover { background: var(--ink-2); color: #fff; }
.nav-link[aria-current="page"] { background: #fff; color: #1B2550; }
.side .new-order { margin: 14px 4px 10px; justify-content: center; }
.side-foot { margin-top: auto; padding: 10px; font-size: .8rem; display: flex; gap: 8px; flex-wrap: wrap; }
.side-foot button { background: none; border: 0; color: var(--ink-text); cursor: pointer; padding: 4px 0; text-decoration: underline; text-underline-offset: 3px; }
.main { min-width: 0; padding: 28px 32px 60px; max-width: 1240px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { color: var(--muted); margin-top: 4px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mobile-top, .tabbar { display: none; }

/* ---------- Nút & trường nhập ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 9px 14px; border-radius: var(--radius); font-weight: 600; font-size: .92rem; cursor: pointer; text-decoration: none; white-space: nowrap; min-height: 40px; }
.btn:hover { border-color: var(--muted); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
:root[data-theme="dark"] .btn-primary { background: var(--blue); border-color: var(--blue); color: #0B0F22; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { background: var(--blue); border-color: var(--blue); color: #0B0F22; } }
.btn-primary:hover { filter: brightness(1.15); border-color: transparent; }
.btn-jade { background: var(--jade); border-color: var(--jade); color: #fff; }
.btn-danger { color: var(--red); }
.btn-danger:hover { border-color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-sm { padding: 5px 10px; min-height: 32px; font-size: .85rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 8px; display: inline-grid; place-items: center; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: .85rem; font-weight: 500; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-s); padding: 9px 11px; min-height: 40px; }
textarea.input { resize: vertical; min-height: 72px; }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--blue-soft); }
.input.money { text-align: right; font-variant-numeric: tabular-nums; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); }
.search .input { padding-left: 36px; }

/* ---------- Bề mặt ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); }
.panel-pad { padding: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 13px; font-size: .86rem; cursor: pointer; font-weight: 500; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-pending { background: var(--amber-soft); color: var(--amber); }
.st-confirmed { background: var(--blue-soft); color: var(--blue); }
.st-shipping { background: var(--violet-soft); color: var(--violet); }
.st-completed, .pay-paid { background: var(--jade-soft); color: var(--jade); }
.st-cancelled { background: var(--red-soft); color: var(--red); }
.pay-unpaid { background: var(--surface-2); color: var(--muted); }
.tag { font-size: .75rem; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-weight: 500; }

/* ---------- Bảng ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th { text-align: left; font-weight: 500; color: var(--muted); font-size: .82rem; padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr.click { cursor: pointer; }
table.data tbody tr.click:hover { background: var(--surface-2); }
table.data .right, table.data th.right { text-align: right; }
.cell-main { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: .82rem; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); font-size: .88rem; color: var(--muted); gap: 10px; flex-wrap: wrap; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty .btn { margin-top: 14px; }

/* ---------- Tổng quan ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 18px 20px; }
.kpi .label { color: var(--muted); font-size: .86rem; font-weight: 500; }
.kpi .value { font-size: 1.65rem; font-weight: 700; margin: 6px 0 4px; letter-spacing: -.02em; }
.kpi .value small { font-size: .9rem; font-weight: 500; color: var(--muted); margin-left: 2px; }
.delta { font-size: .82rem; font-weight: 600; }
.delta.up { color: var(--jade); }
.delta.down { color: var(--red); }
.kpi.hero { background: var(--ink); border-color: var(--ink); color: #fff; }
.kpi.hero .label, .kpi.hero .value small { color: var(--ink-text); }
:root[data-theme="dark"] .kpi.hero { background: #26357A; border-color: #34459A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .kpi.hero { background: #26357A; border-color: #34459A; } }
.kpi.hero .delta.up { color: #6FE3BF; }
.kpi.hero .delta.down { color: #FF9C8C; }
.dash-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 18px; }
.chart { padding: 8px 20px 16px; }
.chart svg { width: 100%; height: 240px; display: block; }
.chart .bar { fill: var(--blue); }
.chart .bar:hover, .chart .bar.on { fill: var(--ink); }
:root[data-theme="dark"] .chart .bar:hover { fill: var(--jade); }
.chart .axis { fill: var(--muted); font-size: 13px; }
.chart .gridline { stroke: var(--line); stroke-dasharray: 3 4; }
.chart-tip { min-height: 22px; font-size: .86rem; color: var(--muted); padding: 0 20px 4px; }
.chart-tip b { color: var(--text); }
.status-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-2); margin: 6px 0 14px; }
.status-bar span { display: block; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: .86rem; }
.legend div { display: flex; justify-content: space-between; gap: 8px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; }
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.rank li:last-child { border-bottom: 0; }
.rank .meter { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.rank .meter span { display: block; height: 100%; background: var(--jade); }
.range { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.range .input { width: auto; min-height: 36px; padding: 6px 9px; }

/* ---------- Đơn hàng ---------- */
.order-layout { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
.sticky { position: sticky; top: 20px; }
.order-layout > *, .dash-grid > *, .stack > * { min-width: 0; }
.line-items { width: 100%; border-collapse: collapse; }
.line-items td, .line-items th { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; font-size: .92rem; }
.line-items th { color: var(--muted); font-weight: 500; font-size: .82rem; }
.line-items .qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-s); }
.line-items .qty button { border: 0; background: none; width: 30px; height: 34px; cursor: pointer; font-size: 1.1rem; color: var(--muted); }
.line-items .qty input { width: 48px; border: 0; text-align: center; background: transparent; height: 34px; font-variant-numeric: tabular-nums; }
.line-items .price-input { width: 120px; }
.picker { position: relative; }
.picker-list { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 320px; overflow-y: auto; }
.picker-list button { display: flex; width: 100%; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 0; background: none; text-align: left; cursor: pointer; border-bottom: 1px solid var(--line); }
.picker-list button:last-child { border-bottom: 0; }
.picker-list button:hover, .picker-list button.active { background: var(--surface-2); }
.picker-list button[disabled] { opacity: .45; cursor: not-allowed; }
.sum-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; }
.sum-row .input { width: 140px; min-height: 36px; padding: 6px 10px; }
.sum-total { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 14px; font-size: 1.05rem; font-weight: 700; }
.sum-total .num { font-size: 1.5rem; letter-spacing: -.02em; }
.seg { display: flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.seg button { flex: 1; border: 0; background: var(--surface); padding: 8px 6px; cursor: pointer; font-size: .86rem; font-weight: 500; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--surface); }

.steps { display: flex; list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li { flex: 1; position: relative; text-align: center; font-size: .82rem; color: var(--muted); padding-top: 30px; }
.steps li::before { content: ''; position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); z-index: 1; }
.steps li::after { content: ''; position: absolute; top: 15px; left: -50%; width: 100%; height: 2px; background: var(--line); }
.steps li:first-child::after { display: none; }
.steps li.done { color: var(--text); font-weight: 600; }
.steps li.done::before { background: var(--jade); border-color: var(--jade); }
.steps li.done::after { background: var(--jade); }
.steps li.now::before { box-shadow: 0 0 0 5px var(--jade-soft); }
.cancel-note { background: var(--red-soft); color: var(--red); padding: 12px 16px; border-radius: var(--radius); font-weight: 500; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.qr-box { display: flex; gap: 16px; align-items: center; }
.qr-box img { width: 148px; height: 148px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }

/* ---------- Hóa đơn in nhiệt ---------- */
.print-page { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 28px 16px 60px; min-height: 100vh; background: var(--surface-2); }
.print-bar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.receipt { width: 80mm; max-width: 100%; background: #fff; color: #111; padding: 18px 14px 26px; font-size: 12.5px; line-height: 1.45; box-shadow: var(--shadow); position: relative; }
.receipt::after { content: ''; position: absolute; left: 0; right: 0; bottom: -8px; height: 8px; background: radial-gradient(circle at 6px 0, transparent 5px, #fff 5.5px) -6px 0 / 12px 8px repeat-x; }
.receipt.a5 { width: 148mm; font-size: 13.5px; padding: 28px 30px 34px; }
.receipt h2 { text-align: center; font-size: 15px; text-transform: uppercase; letter-spacing: .04em; }
.receipt .c { text-align: center; }
.receipt .rule { border-top: 1px dashed #777; margin: 10px 0; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td { padding: 3px 0; vertical-align: top; }
.receipt .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.receipt .item-name { font-weight: 600; }
.receipt .grand td { font-size: 15px; font-weight: 700; padding-top: 6px; }
.receipt .qr { display: block; margin: 10px auto 4px; width: 46mm; height: 46mm; }
@media print {
  @page { margin: 4mm; }
  body { background: #fff; }
  .print-page { padding: 0; background: #fff; }
  .print-bar { display: none !important; }
  .receipt { box-shadow: none; padding: 0; width: 100%; max-width: none; }
  .receipt::after { display: none; }
  .receipt.thermal { width: 72mm; }
}

/* ---------- Hộp thoại & thông báo ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(12, 16, 36, .5); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .15s ease-out; }
.modal { background: var(--surface); border-radius: var(--radius-l); width: 100%; max-width: 540px; max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: pop .18s ease-out; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 20px; flex-wrap: wrap; }
#toast-root { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--text); color: var(--surface); padding: 11px 16px; border-radius: var(--radius); box-shadow: var(--shadow); font-weight: 500; max-width: 360px; animation: pop .18s ease-out; }
.toast.err { background: var(--red); color: #fff; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.skeleton { height: 120px; border-radius: var(--radius-l); background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Đăng nhập ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-art { background: var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art .big { font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 700; line-height: 1.1; letter-spacing: -.03em; max-width: 12ch; }
.login-art p { color: var(--ink-text); max-width: 36ch; margin-top: 14px; }
.login-ticket { background: #fff; color: #182033; border-radius: 4px; padding: 16px 18px; width: 260px; font-size: .85rem; transform: rotate(-3deg); box-shadow: 0 18px 40px rgba(0,0,0,.35); }
.login-ticket .row { display: flex; justify-content: space-between; padding: 3px 0; }
.login-ticket .tot { border-top: 1px dashed #999; margin-top: 6px; padding-top: 8px; font-weight: 700; }
.login-form { display: grid; place-items: center; padding: 32px; }
.login-form form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 16px; }
.err-text { color: var(--red); font-size: .88rem; min-height: 1.2em; }

/* ---------- Điện thoại ---------- */
@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .dash-grid, .order-layout { grid-template-columns: 1fr; }
  .sticky { position: static; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 16px 16px 100px; }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 30; }
  .mobile-top .brand { padding: 0; font-size: .98rem; }
  .mobile-top .icon-btn { color: #fff; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 30; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .7rem; color: var(--muted); text-decoration: none; padding: 4px 0; font-weight: 500; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a[aria-current="page"] { color: var(--text); }
  .tabbar a.fab span.f { width: 46px; height: 46px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; margin-top: -20px; box-shadow: 0 6px 16px rgba(27,37,80,.35); }
  h1 { font-size: 1.35rem; }
  .page-head { margin-bottom: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 28px 24px; min-height: 240px; }
  .login-ticket { display: none; }
  #toast-root { left: 16px; right: 16px; bottom: 84px; }
  .search { max-width: none; }
  /* Bảng thành thẻ trên điện thoại */
  table.cards thead { display: none; }
  table.cards tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  table.cards td { padding: 0; border: 0; }
  table.cards td.hide-m { display: none; }
  table.cards td.right { text-align: right; }
  /* Dòng sản phẩm trong form: tên ở trên, số lượng | đơn giá | xóa ở dưới */
  .line-items thead { display: none; }
  .line-items tr { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .line-items td { padding: 0; border: 0; }
  .line-items td:first-child { grid-column: 1 / -1; }
  .line-items .price-input { width: 100%; }
  .line-items .hide-m { display: none; }
  .table-wrap { max-width: 100%; }
}
@media (max-width: 480px) {
  .kpi .value { font-size: 1.3rem; }
  .kpi { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Chọn ngành (trang Sản phẩm & kho) */
.ind-pick { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.ind-pick select.input { width: auto; min-width: 150px; }
.ind-note { margin: -6px 0 12px; font-size: .88em; }

/* Gợi ý combo (trang Tạo đơn) */
.combo-opt { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px 14px; background: var(--surface); }
.combo-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.combo-lines { list-style: none; margin: 0; padding: 0; }
.combo-lines li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.combo-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.combo-foot .muted { margin-right: auto; }

/* Tài khoản */
label.check { display: flex; gap: 10px; align-items: center; font-size: .92rem; cursor: pointer; }
.acc-inds { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px 16px; }
.acc-inds legend { padding: 0 6px; font-size: .85rem; color: var(--muted); }
.acc-inds:disabled { opacity: .5; }
.side-foot .who { padding: 6px 12px; overflow-wrap: anywhere; }

/* Đơn nhập hàng */
.tag-import { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.import-note { margin: -6px 0 16px; padding: 10px 14px; border-radius: var(--radius); background: var(--surface); border: 1px dashed var(--line); }

/* Ảnh sản phẩm */
.prod-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--surface-2); flex: none; display: block; }
.thumb-sm { width: 36px; height: 36px; border-radius: 8px; }
.thumb-btn { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 10px; flex: none; }
.thumb-btn:hover .thumb, .thumb-btn:focus-visible .thumb { outline: 2px solid var(--accent, #2563eb); outline-offset: 2px; }
.img-edit { display: flex; gap: 14px; align-items: center; }
.thumb-lg { width: 96px; height: 96px; border-radius: 14px; object-fit: cover; background: var(--surface-2); flex: none; }
.thumb-empty { display: grid; place-items: center; font-size: 12px; color: var(--muted, #888); border: 1px dashed var(--line); }
.thumb-lg[hidden], .thumb-empty[hidden] { display: none; }

/* Tự đổi giá 7 ngày */
.ap-table td { vertical-align: middle; }
.ap-pct { width: 72px; text-align: right; }
.ap-up { color: var(--green, #0e9f6e); }
.ap-down { color: var(--red, #d63939); }
.switch input { width: 20px; height: 20px; cursor: pointer; accent-color: var(--accent, #2563eb); }

/* ===== Trang đăng nhập (bản mới) ===== */
.lg2 { background: var(--bg); }
/* Nửa trái luôn nền tối (không đổi theo mẫu giao diện / chế độ tối) để chữ luôn rõ */
.lg2 .lg-art { position: relative; overflow: hidden; isolation: isolate; gap: 28px; color: #fff;
  background: radial-gradient(120% 90% at 0% 0%, #2B3F9E 0%, #121838 55%), #121838; }
.lg-glow { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; z-index: -1; pointer-events: none; }
.lg-glow.g1 { width: 420px; height: 420px; right: -120px; top: -120px; background: rgba(124, 92, 230, .8); animation: lg-drift 14s ease-in-out infinite alternate; }
.lg-glow.g2 { width: 360px; height: 360px; left: -100px; bottom: -140px; background: rgba(22, 170, 128, .7); animation: lg-drift 18s ease-in-out infinite alternate-reverse; }
.lg-grid { position: absolute; inset: 0; z-index: -1; opacity: .12; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%); -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%); }
.lg-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; }
.lg-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #16AA80, #2F5BD3); box-shadow: 0 6px 18px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.35); }
.lg-mark-lg { width: 48px; height: 48px; border-radius: 14px; font-size: 1.35rem; margin-bottom: 18px; }
.lg-copy .big { max-width: 14ch; }
.lg-hl { background: linear-gradient(90deg, #7FF0C9, #9FB8FF 60%, #D3B8FF); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lg-copy p { color: rgba(255,255,255,.72); }
.lg-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; padding: 0; }
.lg-chips li { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px; font-size: .82rem; font-weight: 500;
  background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.16); backdrop-filter: blur(6px); }
.lg-chips svg { width: 15px; height: 15px; opacity: .9; }
.lg-stage { position: relative; height: 270px; max-width: 520px; }
.lg-card { position: absolute; border-radius: 16px; color: #182033; background: rgba(255,255,255,.96); box-shadow: 0 24px 50px -12px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.4); }
.lg-ticket { left: 0; top: 10px; width: 280px; padding: 16px 18px; transform: rotate(-4deg); font-size: .82rem; animation: lg-float 7s ease-in-out infinite; }
.lg-tk-head { display: flex; justify-content: space-between; padding-bottom: 8px; margin-bottom: 6px; border-bottom: 1px dashed #c9cdd9; font-size: .8rem; }
.lg-ticket .row { display: flex; justify-content: space-between; padding: 3px 0; color: #4a5168; }
.lg-tk-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #c9cdd9; }
.lg-tk-foot small { display: block; color: #6b7287; font-size: .72rem; }
.lg-tk-foot b { font-size: 1.05rem; color: #0E8F6E; }
.lg-qr { display: grid; grid-template-columns: repeat(9, 5px); gap: 1px; padding: 4px; background: #fff; border: 1px solid #e3e6ee; border-radius: 6px; }
.lg-qr i { width: 5px; height: 5px; display: block; }
.lg-qr i.on { background: #182033; }
.lg-stat { right: 0; top: 0; width: 220px; padding: 14px 16px; transform: rotate(3deg); animation: lg-float 8s ease-in-out -2s infinite; }
.lg-stat small { color: #6b7287; font-size: .74rem; display: block; }
.lg-stat b { font-size: 1.2rem; letter-spacing: -.02em; }
.lg-spark { width: 100%; height: 36px; color: #2F5BD3; margin: 6px 0 2px; display: block; }
.lg-up { font-size: .74rem; font-weight: 600; color: #0E8F6E; }
.lg-toast { right: 30px; bottom: 6px; display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 12px; font-size: .8rem; animation: lg-float 6s ease-in-out -4s infinite; }
.lg-toast b { display: block; font-size: .82rem; }
.lg-toast small { color: #6b7287; }
.lg-dot { width: 10px; height: 10px; border-radius: 50%; background: #0E8F6E; box-shadow: 0 0 0 4px rgba(14,143,110,.18); animation: lg-pulse 2s ease-out infinite; flex: none; }
.lg-form { background: radial-gradient(80% 60% at 100% 0%, var(--blue-soft), transparent 70%), var(--bg); }
.lg-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 36px 32px 28px !important; max-width: 420px !important;
  box-shadow: 0 30px 60px -30px rgba(24,32,51,.35), 0 2px 6px rgba(24,32,51,.04); animation: lg-in .5s cubic-bezier(.2,.8,.2,1) both; }
.lg-head h1 { font-size: 1.6rem; letter-spacing: -.02em; }
.lg-head p { margin-top: 6px; font-size: .9rem; }
.lg-input { position: relative; display: flex; align-items: center; }
.lg-input > svg { position: absolute; left: 13px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; transition: color .15s; }
.lg-input .input { width: 100%; padding-left: 42px; height: 46px; border-radius: 12px; transition: border-color .15s, box-shadow .15s; }
.lg-input .input:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 18%, transparent); }
.lg-input:focus-within > svg { color: var(--focus); }
.lg-input input[type="password"], .lg-input input[name="password"] { padding-right: 46px; }
.lg-eye { position: absolute; right: 6px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); border-radius: 9px; cursor: pointer; }
.lg-eye:hover { background: var(--surface-2); color: var(--text); }
.lg-eye svg { width: 18px; height: 18px; }
.lg-caps { color: var(--amber); font-size: .78rem; margin-top: 6px; display: block; }
.lg-caps[hidden] { display: none; }
.lg2 .btn.lg-submit { height: 48px; border-radius: 12px; justify-content: center; gap: 8px; font-size: 1rem; margin-top: 4px; color: #fff; border: 0;
  background: linear-gradient(135deg, #2F5BD3, #6C4BC6); box-shadow: 0 10px 22px -8px rgba(47, 91, 211, .6); transition: transform .15s, box-shadow .15s, filter .15s; }
.lg2 .btn.lg-submit:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 14px 26px -8px rgba(47, 91, 211, .7); }
.lg2 .btn.lg-submit:disabled { opacity: .85; cursor: progress; }
.lg-panel .err-text:empty { display: none; }
.lg-submit svg { width: 18px; height: 18px; transition: transform .15s; }
.lg-submit:hover svg { transform: translateX(3px); }
.lg-spin { display: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; animation: lg-rot .7s linear infinite; }
.lg-submit.loading .lg-spin { display: inline-block; }
.lg-submit.loading svg { display: none; }
.lg-foot { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: .78rem; margin-top: 4px; }
.lg-foot svg { width: 14px; height: 14px; }
.lg-panel.shake { animation: lg-shake .4s; }
@keyframes lg-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
@keyframes lg-drift { to { transform: translate(-40px, 30px) scale(1.08); } }
@keyframes lg-pulse { 0% { box-shadow: 0 0 0 0 rgba(14,143,110,.45); } 100% { box-shadow: 0 0 0 10px rgba(14,143,110,0); } }
@keyframes lg-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes lg-rot { to { transform: rotate(360deg); } }
@keyframes lg-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .lg2 *, .lg2 *::before { animation: none !important; transition: none !important; } }
@media (max-width: 1100px) { .lg-stat { display: none; } }
@media (max-width: 860px) {
  .lg-art { min-height: 0 !important; padding: 22px 20px 26px !important; gap: 16px; }
  .lg-stage { display: none; }
  .lg-copy .big { font-size: 1.7rem; }
  .lg-copy p { font-size: .9rem; }
  .lg-chips { margin-top: 14px; }
  .lg-form { padding: 20px 16px 32px !important; align-items: start; }
  .lg-panel { padding: 26px 20px 22px !important; border-radius: 18px; margin-top: -18px; position: relative; }
  .lg-mark-lg { display: none; }
}
