/* ============================================================
   QLBH-Order – giao diện
   Thiết kế: nền dịu, thẻ bo tròn lớn, viền mảnh, bóng mềm,
   màu chủ đạo xanh indigo, điều khiển nhập liệu cao 40px.
   ============================================================ */
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --border: #e6e9f2;
  --border-strong: #cfd6e4;
  --primary: #3b5bfd;
  --primary-dark: #2f49d6;
  --primary-soft: #eef1ff;
  --primary-ring: rgba(59, 91, 253, .18);
  --success: #16a34a;
  --success-soft: #e8f8ee;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --warning: #d97706;
  --warning-soft: #fff4e5;
  --info-soft: #e7f0ff;
  --sidebar: #0f172a;
  --sidebar-2: #131d35;
  --sidebar-text: #aab4c8;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px -6px rgba(15, 23, 42, .08);
  --shadow-lg: 0 20px 50px -12px rgba(15, 23, 42, .25);
  --ctl-h: 40px;
  --chev: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  --chev-primary: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233b5bfd' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  --chev-white: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 14px; line-height: 1.45; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
* { scrollbar-width: thin; scrollbar-color: #c7cfdd transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #c7cfdd; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #aab4c8; background-clip: padding-box; }
.hidden { display: none !important; }
a { color: var(--primary); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 15.5px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.b { font-weight: 650; }
.r { text-align: right; }
.c { text-align: center; }
.mono { font-variant-numeric: tabular-nums; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 2px; }

/* ---------- Đăng nhập ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: #fff; }
.login-brand { position: relative; overflow: hidden; color: #fff; background: radial-gradient(1200px 600px at -10% -10%, rgba(99, 132, 255, .5), transparent 60%), radial-gradient(900px 500px at 110% 110%, rgba(45, 212, 191, .35), transparent 60%), linear-gradient(160deg, #0b1220 0%, #182a66 55%, #2f49d6 100%); display: flex; align-items: center; justify-content: center; padding: 48px; }
.login-brand::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px); background-size: 26px 26px; mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .6), transparent 80%); pointer-events: none; }
.login-brand-inner { position: relative; max-width: 460px; width: 100%; }
.login-brand-logo svg { width: 64px; height: 64px; }
.login-brand h1 { font-size: 34px; line-height: 1.15; margin-top: 24px; letter-spacing: -.02em; }
.login-brand-sub { margin: 12px 0 36px; font-size: 15px; color: rgba(255, 255, 255, .78); line-height: 1.6; }
.login-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.login-features li { display: flex; gap: 14px; align-items: flex-start; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); border-radius: 14px; padding: 14px 16px; backdrop-filter: blur(6px); }
.login-features .lf-ico { font-size: 22px; line-height: 1; padding-top: 2px; }
.login-features b { display: block; font-size: 14px; margin-bottom: 2px; }
.login-features span:not(.lf-ico) { font-size: 13px; color: rgba(255, 255, 255, .72); }
.login-brand-foot { margin-top: 40px; font-size: 12px; color: rgba(255, 255, 255, .55); }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 48px 32px; background: #fff; }
.login-form { width: 100%; max-width: 400px; }
.login-form-head { margin-bottom: 28px; }
.login-form-head h2 { font-size: 26px; letter-spacing: -.02em; }
.login-form-head p { margin: 6px 0 0; }
.lf-field { display: block; margin-bottom: 18px; }
.lf-field > span { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.lf-input { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--border); border-radius: 12px; padding: 0 12px 0 14px; background: #f8fafc; transition: border-color .15s, box-shadow .15s, background .15s; }
.lf-input:focus-within { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px var(--primary-ring); }
.lf-input > svg { width: 20px; height: 20px; color: #94a3b8; flex-shrink: 0; }
.lf-input:focus-within > svg { color: var(--primary); }
.lf-input input { flex: 1; min-width: 0; border: none; background: transparent; padding: 13px 0; font-size: 15px; height: auto; box-shadow: none !important; }
.lf-eye { border: none; background: transparent; padding: 6px; border-radius: 8px; color: #94a3b8; cursor: pointer; display: inline-flex; }
.lf-eye:hover { color: var(--text); background: #eef1f6; }
.lf-eye svg { width: 20px; height: 20px; }
.lf-row { display: flex; align-items: center; justify-content: space-between; margin: -4px 0 18px; }
.lf-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: #4b5563; cursor: pointer; user-select: none; }
.lf-check input { accent-color: var(--primary); width: 16px; height: 16px; margin: 0; }
.lf-error { display: flex; align-items: center; gap: 8px; background: var(--danger-soft); border: 1px solid #fecaca; color: #b91c1c; border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 14px; }
.lf-error::before { content: "⚠"; }
.lf-error.locked { background: var(--warning-soft); border-color: #fed7aa; color: #9a3412; align-items: flex-start; }
.lf-error.locked::before { content: "🔒"; }
.lf-submit { width: 100%; border: none; border-radius: 12px; padding: 14px 16px; font-size: 15px; font-weight: 650; font-family: inherit; color: #fff; cursor: pointer; background: linear-gradient(135deg, #3b5bfd, #2f49d6); box-shadow: 0 10px 24px -8px rgba(59, 91, 253, .6); display: inline-flex; align-items: center; justify-content: center; gap: 10px; transition: transform .1s, box-shadow .15s, filter .15s; }
.lf-submit:hover { filter: brightness(1.05); box-shadow: 0 14px 28px -8px rgba(59, 91, 253, .7); }
.lf-submit:active { transform: translateY(1px); }
.lf-submit:disabled { opacity: .7; cursor: progress; }
.lf-spinner { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; display: none; animation: spin .7s linear infinite; }
.lf-submit.loading .lf-spinner { display: inline-block; }
.lf-help { text-align: center; margin-top: 22px; }
.lf-test { margin-top: 14px; text-align: center; }
.lf-test-link { border: none; background: transparent; color: var(--primary); font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.lf-test-link:hover { background: rgba(37, 99, 235, .08); }
.lf-test-list { margin-top: 10px; text-align: left; border: 1px dashed #d1d5db; border-radius: 12px; padding: 10px; background: #fafbff; }
.lf-test-list .ta-note { font-size: 11.5px; color: #9ca3af; margin: 0 2px 8px; }
.ta-row { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-radius: 8px; }
.ta-row:hover { background: #fff; }
.ta-row + .ta-row { border-top: 1px dashed #e5e7eb; }
.ta-row .ta-info { flex: 0 0 auto; min-width: 100px; }
.ta-row .ta-info b { display: block; font-size: 12px; }
.ta-row .ta-info span { font-size: 11px; color: var(--muted); }
.ta-row .ta-cred { flex: 1; font-size: 12px; color: #4b5563; }
.ta-row .ta-cred code { background: #eef0f5; border-radius: 4px; padding: 1px 5px; font-size: 11.5px; }
.shake { animation: shake .35s; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { padding: 32px 24px; min-height: auto; }
  .login-brand h1 { font-size: 26px; margin-top: 16px; }
  .login-features { display: none; }
  .login-brand-sub { margin-bottom: 0; }
  .login-brand-foot { display: none; }
  .login-panel { padding: 32px 20px 48px; }
}

/* ---------- Bố cục ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%); color: var(--sidebar-text); display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 20; transition: transform .22s ease; }
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 16px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.brand-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: linear-gradient(135deg, #3b5bfd, #7c3aed); box-shadow: 0 8px 20px -8px rgba(59, 91, 253, .8); flex-shrink: 0; }
.brand-name { color: #fff; font-weight: 700; font-size: 14.5px; line-height: 1.25; }
.brand-sub { font-size: 11px; opacity: .6; margin-top: 2px; }
nav { flex: 1; overflow-y: auto; padding: 10px; }
nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--sidebar-text); font-weight: 500; margin-bottom: 2px; transition: background .15s, color .15s; }
nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
nav a.active { background: linear-gradient(135deg, #3b5bfd, #4f6bff); color: #fff; box-shadow: 0 8px 18px -8px rgba(59, 91, 253, .9); }
nav a .ico { width: 24px; text-align: center; font-size: 16px; opacity: .95; }
.nav-sec { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .38); padding: 14px 12px 6px; font-weight: 700; }
.store-bar { margin: 12px 10px 0; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); }
.store-bar .sb-label { font-size: 10.5px; color: rgba(255, 255, 255, .45); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; margin-bottom: 8px; }
.store-bar .sb-name { color: #fff; font-weight: 600; font-size: 13px; margin: 2px 0 6px; line-height: 1.3; }
.store-bar select { width: 100%; background-color: rgba(255, 255, 255, .08); background-image: var(--chev-white); color: #fff; border-color: rgba(255, 255, 255, .14); font-size: 13px; height: 38px; }
.store-bar select:hover { border-color: rgba(255, 255, 255, .3); background-color: rgba(255, 255, 255, .11); }
.store-bar select:focus { border-color: #6b86ff; box-shadow: 0 0 0 3px rgba(107, 134, 255, .3); background-image: var(--chev-white); }
.store-bar select option { color: var(--text); background: #fff; }
.store-bar .btn { width: 100%; margin-top: 8px; }
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .07); }
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 6px; border-radius: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 12px; background: linear-gradient(135deg, #3b5bfd, #7c3aed); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.user-name { color: #fff; font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; opacity: .65; }
.main { flex: 1; margin-left: 250px; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 60px; background: rgba(255, 255, 255, .82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 10; }
.tb-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.topbar h2 { font-size: 19px; letter-spacing: -.02em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-desc { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-desc:empty { display: none; }
#clock { font-variant-numeric: tabular-nums; font-size: 13px; background: #f1f4f9; padding: 6px 10px; border-radius: 8px; }
#btnMenu { display: none; }
.content { padding: 24px; flex: 1; }

/* ---------- Thành phần ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 8px; flex-wrap: wrap; }
.card-title h3 { font-size: 15.5px; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Ô số liệu (.stat) — cùng kiểu với ô chỉ số trang Báo cáo (.kpi); ô "accent" là ô nổi bật màu xanh */
.stat { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; }
.stat .label { font-size: 13px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.stat .value { font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; color: var(--text); }
.stat .sub { font-size: 12.5px; color: var(--muted); }
.stat.green .label::before, .stat.red .label::before, .stat.orange .label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.stat.green .label::before { background: var(--success); }
.stat.red .label::before { background: var(--danger); }
.stat.orange .label::before { background: var(--warning); }
.stat.accent { background: linear-gradient(135deg, #3b5bfd 0%, #2f49d6 100%); border-color: transparent; box-shadow: 0 12px 28px -14px rgba(59, 91, 253, .8); }
.stat.accent .label, .stat.accent .sub { color: rgba(255, 255, 255, .8); }
.stat.accent .value, .stat.accent .sub b { color: #fff; }

/* Nút */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border-strong); background: #fff; color: var(--text); padding: 0 14px; height: 38px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 550; cursor: pointer; font-family: inherit; white-space: nowrap; line-height: 1; box-shadow: 0 1px 2px rgba(15, 23, 42, .05); transition: background .15s, box-shadow .15s, border-color .15s, transform .08s, filter .15s; }
.btn:hover { background: #f6f8fc; border-color: #b9c3d6; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: linear-gradient(135deg, #3b5bfd, #2f49d6); border-color: transparent; color: #fff; box-shadow: 0 6px 16px -6px rgba(59, 91, 253, .7); }
.btn.primary:hover { filter: brightness(1.06); box-shadow: 0 8px 20px -6px rgba(59, 91, 253, .8); }
.btn.success { background: linear-gradient(135deg, #22c55e, #16a34a); border-color: transparent; color: #fff; box-shadow: 0 6px 16px -6px rgba(22, 163, 74, .6); }
.btn.success:hover { filter: brightness(1.05); }
.btn.danger { background: linear-gradient(135deg, #ef4444, #dc2626); border-color: transparent; color: #fff; box-shadow: 0 6px 16px -6px rgba(220, 38, 38, .55); }
.btn.danger:hover { filter: brightness(1.05); }
.btn.warning { background: linear-gradient(135deg, #f59e0b, #d97706); border-color: transparent; color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: inherit; box-shadow: none; }
.btn.ghost:hover { background: rgba(15, 23, 42, .06); border-color: transparent; }
.btn.ghost.text-danger:hover { background: var(--danger-soft); }
.sidebar .btn.ghost { color: var(--sidebar-text); }
.sidebar .btn.ghost:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15.5px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.icon { width: 36px; height: 36px; padding: 0; font-size: 18px; border-radius: 9px; }

/* Ô nhập, select, textarea */
input, select, textarea {
  font-family: inherit; font-size: 14px; color: var(--text); background: #fff;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 0 12px; height: var(--ctl-h); outline: none;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .03);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
input::placeholder, textarea::placeholder { color: #9aa5b8; }
input:hover, select:hover, textarea:hover { border-color: #aeb9cc; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
input:disabled, select:disabled, textarea:disabled { background: #f3f5f9; color: var(--muted); cursor: not-allowed; }
textarea { resize: vertical; min-height: 72px; height: auto; padding: 10px 12px; line-height: 1.5; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; padding: 0; accent-color: var(--primary); cursor: pointer; box-shadow: none; }
input[type=checkbox] { border-radius: 5px; }
input[type=number] { font-variant-numeric: tabular-nums; }
input[type=date], input[type=time], input[type=datetime-local] { padding-right: 8px; }
input::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .55; border-radius: 6px; padding: 4px; }
input::-webkit-calendar-picker-indicator:hover { opacity: 1; background-color: #eef1f6; }

/* Select: ẩn mũi tên mặc định, vẽ mũi tên SVG, đổi màu khi hover / focus */
select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: var(--chev); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
  padding-right: 38px; cursor: pointer;
}
select:focus { background-image: var(--chev-primary); }
select:disabled { cursor: not-allowed; }
select[multiple], select[size]:not([size="1"]) { background-image: none; padding: 8px; height: auto; }
select option { padding: 8px 10px; }
select::-ms-expand { display: none; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 13px; color: var(--text-2); }
.field.inline { flex-direction: row; align-items: center; gap: 10px; }
.field.inline label { font-weight: 500; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input, .filters select { min-width: 0; }
.date-range { display: inline-flex; align-items: center; gap: 6px; height: var(--ctl-h); padding: 0 6px 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; }
.date-range:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.date-range input[type=date] { border: none; box-shadow: none; padding: 0 4px; height: 100%; width: 132px; background: transparent; }
.date-range input[type=date]:focus { box-shadow: none; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: #eceff5; border-radius: var(--radius-sm); }
.seg button { border: none; background: none; height: 32px; padding: 0 12px; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.seg button:hover:not(.active) { color: var(--primary); }
.seg button.active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }

/* Bảng */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.tbl-wrap .tbl { border: none; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 11px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; white-space: nowrap; }
.tbl td.wrap, .tbl td.empty { white-space: normal; }
.tbl td.wrap { min-width: 220px; }
.tbl td.wrap-sm { white-space: normal; min-width: 150px; }
.tbl th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #f8fafd; font-weight: 700; white-space: nowrap; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover td { background: #f6f8fd; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl td.r, .tbl th.r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .actions { white-space: nowrap; text-align: right; }
.tbl .actions .btn + .btn { margin-left: 4px; }
.tbl .actions .btn.danger { background: var(--danger-soft); color: #b91c1c; border-color: transparent; box-shadow: none; }
.tbl .actions .btn.danger:hover { background: #fbd5d5; filter: none; }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; }

/* Nhãn trạng thái */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef1f6; color: var(--muted); line-height: 1.4; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge.green { background: var(--success-soft); color: #15803d; }
.badge.red { background: var(--danger-soft); color: #b91c1c; }
.badge.blue { background: var(--info-soft); color: var(--primary-dark); }
.badge.orange { background: var(--warning-soft); color: #c2410c; }
.badge.gray { background: #eef1f6; color: #4b5563; }
#topStore::before { display: none; }

/* Tab dạng segmented */
.tabs { display: inline-flex; gap: 2px; background: #eceff5; padding: 5px; border-radius: 12px; margin-bottom: 16px; overflow-x: auto; max-width: 100%; border: 1px solid var(--border); }
.tabs button { background: none; border: none; padding: 9px 16px; font-size: 14px; font-weight: 550; font-family: inherit; cursor: pointer; color: var(--text-2); border-radius: 9px; white-space: nowrap; transition: background .15s, color .15s, box-shadow .15s; margin: 0; display: inline-flex; align-items: center; gap: 6px; }
.tabs button:hover:not(.active) { background: rgba(255, 255, 255, .6); color: var(--primary); }
.tabs button.active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); font-weight: 650; }
/* Tab lớn, dễ thấy (trang Thực đơn) */
.tabs.tabs-lg button { padding: 10px 18px; font-size: 14.5px; }
.tab-count { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: #dfe4ee; color: var(--text-2); font-size: 12px; font-weight: 700; text-align: center; }
.tab-count:empty { display: none; }
.tabs button.active .tab-count { background: var(--primary); color: #fff; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: #fff; cursor: pointer; font-size: 13px; font-weight: 550; font-family: inherit; color: var(--text-2); transition: background .15s, color .15s, border-color .15s; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 6px 14px -6px rgba(59, 91, 253, .7); }

/* ---------- Hộp thoại ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 540px; max-height: 92vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .18s cubic-bezier(.2, .8, .2, 1); overflow: hidden; }
.modal.lg { max-width: 780px; }
.modal.xl { max-width: 980px; }
.modal-head { padding: 16px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 16.5px; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); background: #f8fafd; display: flex; justify-content: flex-end; gap: 8px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: translateY(8px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }

.toasts { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; background: #0f172a; color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .4); animation: slide .2s cubic-bezier(.2, .8, .2, 1); max-width: 380px; font-weight: 500; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; flex-shrink: 0; }
.toast.success::before { background: #4ade80; }
.toast.error::before { background: #f87171; }
@keyframes slide { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.error { color: var(--danger); font-size: 13px; margin-top: 8px; }

/* ---------- Bán hàng / Order ---------- */
.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.table-card { background: #fff; border: 1.5px solid var(--border); border-radius: 14px; padding: 16px 12px; cursor: pointer; text-align: center; transition: transform .12s, box-shadow .15s, border-color .15s; position: relative; min-height: 112px; display: flex; flex-direction: column; justify-content: center; gap: 4px; box-shadow: var(--shadow); }
.table-card::after { content: ""; position: absolute; top: 10px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: #cbd5e1; }
.table-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -10px rgba(15, 23, 42, .25); border-color: var(--primary); }
.table-card.busy { border-color: #f6c58a; background: linear-gradient(180deg, #fff, var(--warning-soft)); }
.table-card.busy::after { background: var(--warning); box-shadow: 0 0 0 3px rgba(217, 119, 6, .18); }
.table-card .tname { font-weight: 700; font-size: 16px; }
.table-card .tinfo { font-size: 12px; color: var(--muted); }
.table-card .ttotal { font-weight: 700; color: var(--warning); font-variant-numeric: tabular-nums; }
.table-card.takeaway { border-style: dashed; border-color: #9fb0ff; background: linear-gradient(180deg, #fff, var(--primary-soft)); }
.table-card.takeaway::after { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.area-title { font-weight: 700; margin: 20px 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--text-2); }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; border: 1.5px solid var(--border-strong); background: #fff; }
.legend span.busy::before { border-color: #f6c58a; background: var(--warning-soft); }

.pos { display: grid; grid-template-columns: 1fr 400px; gap: 16px; height: calc(100vh - 108px); min-height: 500px; }
.pos-menu { display: flex; flex-direction: column; min-height: 0; }
.pos-menu .chips { margin: 12px 0; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; overflow-y: auto; flex: 1; padding-right: 4px; align-content: start; }
.product-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 11px 12px; cursor: pointer; display: flex; align-items: flex-start; gap: 10px; transition: box-shadow .15s, border-color .15s, transform .08s; user-select: none; }
.product-card .pc-ava { width: 38px; height: 38px; border-radius: 11px; font-size: 19px; }
.product-card .pc-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.product-card:hover { border-color: var(--primary); box-shadow: 0 8px 20px -10px rgba(59, 91, 253, .5); }
.product-card:active { transform: scale(.98); }
.product-card .pname { font-weight: 600; line-height: 1.3; }
.product-card .pprice { color: var(--primary); font-weight: 700; font-variant-numeric: tabular-nums; }
.product-card .pstock { font-size: 11.5px; color: var(--muted); }
.product-card.out { opacity: .45; pointer-events: none; }
.pos-cart { display: flex; flex-direction: column; min-height: 0; }
.cart-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.cart-items { flex: 1; overflow-y: auto; margin: 8px 0; }
.cart-item { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.cart-item .ci-name { font-weight: 600; }
.cart-item .ci-note { font-size: 12px; color: var(--warning); font-style: italic; }
.cart-item .ci-price { font-size: 12px; color: var(--muted); }
.cart-item .ci-total { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 999px; overflow: hidden; background: #fff; }
.qty button { border: none; background: transparent; width: 30px; height: 30px; cursor: pointer; font-size: 16px; font-family: inherit; color: var(--text-2); transition: background .12s; }
.qty button:hover { background: var(--primary-soft); color: var(--primary); }
.qty span { min-width: 32px; text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; }
.cart-foot { border-top: 2px solid var(--border); padding-top: 12px; }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 18px; font-weight: 800; margin-bottom: 12px; letter-spacing: -.01em; }
.cart-total span:first-child { font-size: 14px; font-weight: 600; color: var(--muted); }
.cart-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cart-actions .full { grid-column: 1 / -1; }
.pay-summary { background: #f6f8fd; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.pay-summary .line { display: flex; justify-content: space-between; padding: 4px 0; font-variant-numeric: tabular-nums; }
.pay-summary .line.total { font-size: 21px; font-weight: 800; border-top: 1px solid var(--border-strong); margin-top: 8px; padding-top: 10px; color: var(--primary); letter-spacing: -.01em; }
.quick-cash { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.method-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.method-btns .btn.active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }


/* ---------- Báo cáo ---------- */
:root {
  --viz-1: #2a78d6; --viz-8: #e34948;
  --viz-grid: #eef0f4; --viz-axis: #cfd5e1; --viz-track: #eef1f6; --viz-ink-2: #52607a;
  --good: #0f8a3c; --good-soft: #e6f6ec; --bad: #c62f2f; --bad-soft: #fdecec;
}
.rp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rp-head .tabs { margin-bottom: 0; }
.rp-filters { margin: 0; }
.rp-period { margin: 12px 2px 14px; font-size: 13px; color: var(--text-2); }
.rp-body { transition: opacity .2s; }
.rp-body.loading { opacity: .5; pointer-events: none; }
.rp-split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.rp-split.stretch { align-items: stretch; }
.rp-split.stretch > .viz-card { display: flex; flex-direction: column; }
.rp-split.stretch > .viz-card > .vc { flex: 1; }
.rp-stack { display: grid; gap: 16px; }

/* Ô chỉ số */
.kpi { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi-value { font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; color: var(--text); }
.kpi.lead { background: linear-gradient(135deg, #3b5bfd 0%, #2f49d6 100%); border-color: transparent; box-shadow: 0 12px 28px -14px rgba(59, 91, 253, .8); }
.kpi.lead .kpi-label, .kpi.lead .kpi-foot .muted, .kpi.lead .kpi-sub { color: rgba(255, 255, 255, .78); }
.kpi.lead .kpi-value { color: #fff; }
.kpi.lead .kpi-delta { background: rgba(255, 255, 255, .18); color: #fff; }
.kpi-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; min-height: 22px; }
.kpi-sub { color: var(--muted); }
.kpi-delta { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 999px; font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; }
.kpi-delta.good { background: var(--good-soft); color: var(--good); }
.kpi-delta.bad { background: var(--bad-soft); color: var(--bad); }
.kpi-delta.flat { background: #f1f3f7; color: var(--muted); font-weight: 600; }
.status { font-weight: 700; }
.status.good { color: var(--good); } .status.bad { color: var(--bad); }

/* Thẻ biểu đồ */
.viz-card { padding: 18px 20px 20px; }
.viz-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.viz-head h3 { font-size: 15px; font-weight: 700; }
.viz-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.viz-legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-2); font-weight: 550; }
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Biểu đồ cột */
.vc { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: minmax(230px, 1fr) auto; column-gap: 10px; }
.vc-y { position: relative; min-width: 38px; }
.vc-y span { position: absolute; right: 0; transform: translateY(50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.vc-plot { position: relative; }
.vc-grid { position: absolute; left: 0; right: 0; height: 1px; background: var(--viz-grid); }
.vc-grid.base { background: var(--viz-axis); }
.vc-avg { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid rgba(110, 121, 145, .75); z-index: 2; pointer-events: none; }
.viz-legend i.line { width: 16px; height: 0; border-radius: 0; border-top: 2px solid rgba(110, 121, 145, .75); }
.vc-cols { position: absolute; inset: 0; display: flex; gap: 2px; }
.vc-col { flex: 1; position: relative; display: flex; align-items: flex-end; justify-content: center; border-radius: 6px; outline: none; cursor: default; }
.vc-col:hover, .vc-col:focus-visible { background: rgba(42, 120, 214, .07); }
.vc-bar { width: min(24px, 72%); border-radius: 4px 4px 0 0; min-height: 0; transition: height .35s ease, filter .15s; }
.vc-col:hover .vc-bar, .vc-col:focus-visible .vc-bar { filter: brightness(1.12) saturate(1.05); }
.vc-col em { position: absolute; left: 50%; transform: translate(-50%, -4px); font-style: normal; font-size: 11px; font-weight: 700; color: var(--text); white-space: nowrap; z-index: 3; pointer-events: none; }
.vc-x { grid-column: 2; display: flex; gap: 2px; padding-top: 8px; }
.vc-x span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: visible; min-width: 0; }
.vc-div .vc-col { align-items: stretch; }
.vc-div .vc-bar { position: absolute; left: 50%; transform: translateX(-50%); }
.vc-div .vc-bar.up { bottom: 50%; background: var(--viz-1); border-radius: 4px 4px 0 0; }
.vc-div .vc-bar.down { top: 50%; background: var(--viz-8); border-radius: 0 0 4px 4px; }

/* Thanh tỉ trọng */
.sb { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; margin-bottom: 14px; }
.sb-seg { min-width: 3px; outline: none; transition: filter .15s; }
.sb-seg:hover, .sb-seg:focus-visible { filter: brightness(1.12); }
.sb-legend { display: grid; gap: 2px; }
.sb-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 52px; gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--viz-grid); }
.sb-row:last-child { border-bottom: none; }
.sb-row i { width: 10px; height: 10px; border-radius: 3px; }
.sb-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); font-weight: 550; }
.sb-val { font-weight: 650; font-variant-numeric: tabular-nums; }
.sb-pct { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12.5px; }

/* Danh sách xếp hạng */
.rk { display: grid; gap: 4px; }
.rk-row { display: flex; gap: 12px; align-items: flex-start; padding: 7px 8px; margin: 0 -8px; border-radius: 8px; outline: none; }
.rk-row:hover, .rk-row:focus-visible { background: #f6f8fc; }
.rk-no { flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); background: #f1f3f7; font-variant-numeric: tabular-nums; }
.rk-no.top { background: var(--primary-soft); color: var(--primary); }
.rk-main { flex: 1; min-width: 0; }
.rk-line { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.rk-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-val { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rk-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.rk-track { height: 6px; background: var(--viz-track); border-radius: 999px; margin-top: 6px; overflow: hidden; }
.rk-track div { height: 100%; border-radius: 999px; transition: width .35s ease; }

/* Bảng báo cáo */
.rp-tbl th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; background: #f8f9fc; }
.rp-tbl td { font-variant-numeric: tabular-nums; }
.rp-tbl tbody tr:hover td { background: #f8faff; }
.rp-tbl tfoot td { font-weight: 750; background: #f4f6fb; border-top: 1px solid var(--border-strong); border-bottom: none; }
.cat-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.cat-tag i { width: 8px; height: 8px; border-radius: 2px; }
.meter { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.meter span { width: 44px; text-align: right; color: var(--text-2); }
.meter-track { flex: 1; height: 6px; background: #dcebfb; border-radius: 999px; overflow: hidden; }
.meter-track div { height: 100%; background: var(--viz-1); border-radius: 999px; }
.meter-track div.low { background: #eda100; }
.meter-track div.neg { background: var(--viz-8); }

/* Tooltip biểu đồ */
.viz-tip { position: fixed; z-index: 9999; display: none; pointer-events: none; min-width: 150px; max-width: 280px; background: #0f172a; color: #fff; border-radius: 10px; padding: 9px 12px; box-shadow: 0 12px 30px -10px rgba(15, 23, 42, .5); font-size: 12.5px; }
.viz-tip .vt-title { font-weight: 600; color: #aab4c8; margin-bottom: 5px; font-size: 12px; }
.viz-tip .vt-row { display: flex; align-items: center; gap: 8px; line-height: 1.6; }
.viz-tip .vt-row i { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.viz-tip .vt-row i.none { background: transparent; }
.viz-tip .vt-row b { font-weight: 700; font-variant-numeric: tabular-nums; }
.viz-tip .vt-row span { color: #aab4c8; }

/* ---------- Thiết bị nhỏ ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .rp-split { grid-template-columns: 1fr; }
  .pos { grid-template-columns: 1fr 340px; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .45); }
  .main { margin-left: 0; }
  #btnMenu { display: inline-flex; }
  .topbar { padding: 0 14px; }
  .topbar h2 { font-size: 17px; }
  .tb-desc { display: none; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .pos { grid-template-columns: 1fr; height: auto; }
  .pos-menu .product-grid { max-height: 50vh; }
  .content { padding: 14px; }
  .card { padding: 14px 16px; }
}
@media (max-width: 500px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #clock { display: none; }
  .kpi, .stat { padding: 14px; gap: 6px; }
  .date-range { width: 100%; }
  .date-range input[type=date] { flex: 1; width: auto; min-width: 0; }
  .seg { width: 100%; overflow-x: auto; }
  .seg button { flex: 1; padding: 0 8px; }
  #topStore { max-width: 150px; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
  .kpi-value, .stat .value { font-size: 19px; }
  .stat .sub { font-size: 12px; }
  .kpi-foot .muted { display: none; }
  .vc { grid-template-rows: minmax(200px, 1fr) auto; column-gap: 6px; }
  .vc-x span.alt { visibility: hidden; }
  .viz-card { padding: 14px; }
}
@media (max-width: 860px) {
  .rp-head { flex-direction: column; align-items: stretch; }
  .rp-filters input[type=date] { width: auto; flex: 1; }
}
@media print { .sidebar, .topbar { display: none; } .main { margin: 0; } .card { box-shadow: none; } }

/* ---------- Dropdown tùy biến (public/select.js) ---------- */
.cs { position: relative; display: inline-block; vertical-align: middle; max-width: 100%; }
.cs.grow { flex: 1; }
.field > .cs, .store-bar .cs, .form-grid .cs { display: block; }
.field > .cs > select, .store-bar .cs > select, .cs.grow > select { width: 100%; }
.cs > select.cs-native { opacity: 0; pointer-events: none; }
.cs-btn {
  position: absolute; inset: 0; width: 100%; display: flex; align-items: center;
  font: inherit; font-size: 14px; color: var(--text); text-align: left; cursor: pointer;
  background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 0 38px 0 12px; box-shadow: inset 0 1px 2px rgba(15, 23, 42, .03);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.cs-btn::after {
  content: ""; position: absolute; right: 12px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
  background: var(--chev) center / 16px no-repeat; transition: transform .18s ease;
}
.cs-btn:hover { border-color: #aeb9cc; }
.cs-btn:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
.cs.open .cs-btn { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
.cs.open .cs-btn::after { transform: rotate(180deg); background-image: var(--chev-primary); }
.cs-btn:disabled { background: #f3f5f9; color: var(--muted); cursor: not-allowed; }
.cs-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-label.cs-placeholder { color: #8692a6; }
.btn.sm ~ .cs .cs-btn, .filters .cs-btn { font-size: 13.5px; }
/* Biến thể trên sidebar tối */
.store-bar .cs-btn { background: rgba(255, 255, 255, .08); color: #fff; border-color: rgba(255, 255, 255, .14); font-size: 13px; box-shadow: none; }
.store-bar .cs-btn::after { background-image: var(--chev-white); }
.store-bar .cs-btn:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .3); }
.store-bar .cs-btn:focus, .store-bar .cs.open .cs-btn { border-color: #6b86ff; box-shadow: 0 0 0 3px rgba(107, 134, 255, .3); }
.store-bar .cs.open .cs-btn::after { background-image: var(--chev-white); }
.store-bar .cs-label.cs-placeholder { color: rgba(255, 255, 255, .6); }
/* Popup danh sách */
.cs-pop {
  position: fixed; z-index: 300; display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 6px;
  box-shadow: 0 18px 44px -12px rgba(15, 23, 42, .3), 0 2px 6px rgba(15, 23, 42, .06);
  animation: csIn .14s cubic-bezier(.2, .8, .2, 1); transform-origin: top center; outline: none;
}
.cs-pop.up { transform-origin: bottom center; }
@keyframes csIn { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.cs-search { padding: 2px 2px 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.cs-search input { width: 100%; height: 36px; font-size: 13.5px; background: #f6f8fc; border-color: transparent; padding-left: 34px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>");
  background-repeat: no-repeat; background-position: 11px center; }
.cs-search input:focus { background-color: #fff; }
.cs-list { overflow-y: auto; min-height: 0; flex: 1; overscroll-behavior: contain; }
.cs-opt { position: relative; padding: 9px 12px 9px 34px; border-radius: 9px; cursor: pointer; font-size: 13.5px; color: var(--text-2); line-height: 1.35; user-select: none; }
.cs-opt.active { background: var(--primary-soft); color: var(--text); }
.cs-opt.selected { color: var(--primary); font-weight: 650; }
.cs-opt.selected::before {
  content: ""; position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%233b5bfd' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12.5 10 17l9-10'/></svg>") center / 16px no-repeat;
}
.cs-opt.cs-empty:not(.selected) { color: var(--muted); }
.cs-opt.disabled { opacity: .45; cursor: not-allowed; }
.cs-group { padding: 10px 12px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cs-none { padding: 14px 12px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- Gọi món qua QR ---------- */
.bell { position: relative; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: #fff; cursor: pointer; display: inline-grid; place-items: center; font-size: 18px; transition: background .15s, border-color .15s; }
.bell:hover { background: #f6f8fc; }
.bell.ringing { border-color: #f6c58a; background: var(--warning-soft); }
.bell.ringing .bell-ico { display: inline-block; animation: bellShake 1.6s ease-in-out infinite; transform-origin: 50% 10%; }
@keyframes bellShake { 0%, 50%, 100% { transform: rotate(0); } 5%, 15%, 25% { transform: rotate(16deg); } 10%, 20%, 30% { transform: rotate(-16deg); } }
.bell-count { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 0 2px #fff; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 800; display: inline-grid; place-items: center; animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .55); } 70% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); } 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); } }
.toast.toast-bell { background: linear-gradient(135deg, #f59e0b, #d97706); cursor: pointer; font-weight: 650; }
.toast.toast-bell::before { background: #fff; }

.table-card.calling { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .15); animation: pulse 1.6s infinite; }
.table-card.calling::after { background: var(--danger); }
.call-tag { margin: 6px auto 0; border: none; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 700; color: #fff; background: var(--danger); cursor: pointer; font-family: inherit; }

.req-card { border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; background: #fff; box-shadow: var(--shadow); }
.req-card:last-child { margin-bottom: 0; }
.req-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.req-table { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.req-total { font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.req-items { margin: 10px 0 0; padding: 10px 12px 10px 28px; background: #f8fafd; border-radius: 10px; }
.req-items li { padding: 2px 0; }
.req-note { margin-top: 8px; font-size: 13.5px; color: var(--warning); }
.req-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

.qr-box { width: 240px; height: 240px; margin: 0 auto; padding: 10px; border: 1px solid var(--border); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.qr-box svg { width: 100%; height: 100%; display: block; }

/* Thanh nhắc tải lại khi có bản cập nhật */
.update-bar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 250; display: flex; align-items: center; gap: 14px; background: #0f172a; color: #fff; padding: 10px 12px 10px 18px; border-radius: 14px; box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .5); font-weight: 500; animation: pop .2s; max-width: calc(100% - 32px); }
.req-card.pay { border-color: #c7d2fe; background: linear-gradient(180deg, #fff, var(--primary-soft)); }
.req-card.pay .req-table { color: var(--primary-dark); }
.pay-method { margin-top: 10px; padding: 10px 12px; background: #fff; border: 1px dashed #c7d2fe; border-radius: 10px; }
.table-card.paying { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.table-card.paying .call-tag { background: var(--primary); }

/* ---------- Thực đơn ---------- */
.dish-cell { display: flex; align-items: center; gap: 12px; }
.dish-ava { width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.dish-ava.xl { width: 96px; height: 96px; border-radius: 24px; font-size: 48px; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .04); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 13px; font-weight: 600; color: var(--text-2); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span { position: relative; width: 36px; height: 20px; border-radius: 999px; background: #cbd5e1; transition: background .18s; flex-shrink: 0; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .3); transition: transform .18s; }
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 3px solid var(--primary-ring); outline-offset: 2px; }
.switch em { font-style: normal; }
.switch.big span { width: 44px; height: 24px; }
.switch.big span::after { width: 20px; height: 20px; }
.switch.big input:checked + span::after { transform: translateX(20px); }

.dish-form { display: grid; grid-template-columns: 220px 1fr; gap: 24px; }
.dish-preview { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18px 14px; border-radius: 18px; background: linear-gradient(180deg, #f6f8fd, #eef1ff); border: 1px solid var(--border); align-self: start; position: sticky; top: 0; }
.dp-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.dp-card { width: 100%; background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 16px 12px; text-align: center; box-shadow: var(--shadow); transition: opacity .2s, filter .2s; }
.dp-card.off { opacity: .55; filter: grayscale(.6); }
.dp-card .dish-ava { margin: 0 auto 10px; }
.dp-name { font-weight: 750; font-size: 15px; line-height: 1.3; word-break: break-word; }
.dp-price { color: var(--primary); font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.dp-price span { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.dp-cat { display: inline-block; margin-top: 8px; font-size: 11.5px; font-weight: 600; color: var(--muted); background: #f1f4f9; border-radius: 999px; padding: 2px 9px; }
.dish-fields .field { margin-bottom: 16px; }
.req { color: var(--danger); }
.input-lg { height: 46px; font-size: 16px; font-weight: 600; }
.opt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.opt { border: 1px solid var(--border-strong); background: #fff; border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 600; font-family: inherit; color: var(--text-2); cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.opt:hover { border-color: var(--primary); color: var(--primary); }
.opt.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 6px 14px -8px rgba(59, 91, 253, .8); }
.money-in { position: relative; max-width: 260px; }
.money-in input { width: 100%; height: 46px; font-size: 18px; font-weight: 750; padding-right: 36px; font-variant-numeric: tabular-nums; }
.money-in span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }
@media (max-width: 700px) {
  .dish-form { grid-template-columns: 1fr; }
  .dish-preview { position: static; flex-direction: row; justify-content: space-between; }
  .dp-label { display: none; }
  .dp-card { display: grid; grid-template-columns: auto 1fr; gap: 0 12px; text-align: left; align-items: center; padding: 10px; }
  .dp-card .dish-ava { grid-row: span 3; margin: 0; width: 56px; height: 56px; font-size: 28px; border-radius: 16px; }
  .dp-cat { justify-self: start; margin-top: 4px; }
}
.tbl td.r, .switch { white-space: nowrap; }
@media (max-width: 700px) {
  .dish-preview .dp-card { flex: 1; min-width: 0; }
  .dish-preview .switch.big em { display: none; }
}
@media (max-width: 500px) {
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn { flex: 1 1 auto; }
}

/* Cài đặt: chọn mạng cho gọi món QR */
.net-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.net-opt { display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--border); border-radius: 14px; padding: 14px; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.net-opt:hover { border-color: #aeb9cc; }
.net-opt.active { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-ring); }
.net-opt input { margin-top: 2px; flex-shrink: 0; }
.net-opt b { display: block; margin-bottom: 4px; }
.net-opt span { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
@media (max-width: 640px) { .net-opts { grid-template-columns: 1fr; } }

/* ---------- Tổng quan ---------- */
.db-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.db-greet { font-size: 22px; font-weight: 750; letter-spacing: -.02em; }
.db-period { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.db-filters { margin: 0; }
.live-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 rgba(22, 163, 74, .5); animation: livePulse 2s infinite; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .45); } 70% { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); } 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); } }
.live-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.live-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; text-decoration: none; transition: transform .12s, box-shadow .15s, border-color .15s; }
a.live-card:hover { transform: translateY(-1px); border-color: var(--border-strong); box-shadow: 0 10px 24px -14px rgba(15, 23, 42, .35); }
.live-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; background: #f1f3f7; }
.live-card.blue .live-ico { background: #e7f0fd; } .live-card.violet .live-ico { background: #efedfd; }
.live-card.orange .live-ico { background: var(--warning-soft); } .live-card.red .live-ico { background: var(--danger-soft); } .live-card.green .live-ico { background: var(--success-soft); }
.live-card.alert { border-color: #f5c27a; background: #fffaf2; }
.live-main { min-width: 0; flex: 1; }
.live-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.live-value { font-size: 22px; font-weight: 750; letter-spacing: -.02em; line-height: 1.25; }
.live-value small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.live-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-meter { height: 5px; border-radius: 999px; background: #e7f0fd; margin-top: 7px; overflow: hidden; }
.live-meter div { height: 100%; background: var(--viz-1); border-radius: 999px; }
.cf { display: grid; gap: 10px; }
.cf-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13.5px; }
.cf-row b { font-variant-numeric: tabular-nums; }
.cf-name { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); font-weight: 600; }
.cf-name i { width: 10px; height: 10px; border-radius: 3px; }
.cf-track { height: 8px; border-radius: 999px; background: var(--viz-track); overflow: hidden; }
.cf-track div { height: 100%; border-radius: 999px; }
.cf-total { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; border-top: 1px dashed var(--border-strong); font-size: 13.5px; }
.cf-total b { font-size: 17px; font-variant-numeric: tabular-nums; }
.mini-list { display: grid; }
.mini-row { display: flex; align-items: center; gap: 10px; padding: 9px 8px; margin: 0 -8px; border-radius: 10px; color: inherit; text-decoration: none; }
a.mini-row:hover { background: #f6f8fc; }
.mini-row + .mini-row { border-top: 1px solid var(--viz-grid); }
.mini-ico { flex: none; width: 32px; height: 32px; border-radius: 10px; background: #f1f3f7; display: grid; place-items: center; font-size: 15px; }
.mini-main { flex: 1; min-width: 0; font-size: 13.5px; }
.mini-row .r { text-align: right; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.strike { text-decoration: line-through; }
.db-more { text-align: center; margin-top: 18px; }
@media (max-width: 1100px) { .live-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .db-head { flex-direction: column; align-items: stretch; } .db-greet { font-size: 19px; } }
@media (max-width: 500px) { .live-grid { gap: 10px; } .live-card { padding: 12px; gap: 8px; flex-direction: column; } .live-ico { width: 34px; height: 34px; font-size: 16px; } .live-value { font-size: 19px; } }

/* Chú thích vai trò (trang Nhân viên) */
.role-legend { display: grid; gap: 8px; margin-top: 16px; font-size: 13px; color: var(--muted); }
.role-legend > div { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 10px; align-items: center; }
.role-legend .badge { justify-self: start; }
@media (max-width: 500px) { .role-legend > div { grid-template-columns: 1fr; gap: 4px; } }

/* Nhật ký đăng nhập */
.lg-filters { margin-bottom: 16px; }
.tbl tr.lg-failed td { background: #fffafa; }
.lg-alert { border-color: #f5c2c2; background: #fffafa; }
.lg-alerts { display: grid; gap: 6px; }
.lg-alert-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; text-align: left; padding: 8px 10px; border: 1px solid transparent; border-radius: 10px; background: #fff; font: inherit; font-size: 13.5px; cursor: pointer; }
.lg-alert-row:hover { border-color: #f5c2c2; }
.sess-list { display: grid; grid-template-columns: minmax(0, 1fr); }
.sess-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; min-width: 0; }
.sess-row + .sess-row { border-top: 1px solid var(--viz-grid); }
.sess-ico { flex: none; width: 36px; height: 36px; border-radius: 11px; background: #f1f3f7; display: grid; place-items: center; font-size: 17px; }
.sess-main { flex: 1; min-width: 0; font-size: 13.5px; }
.sess-main .badge { margin-left: 4px; vertical-align: 1px; }
.sess-main .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess-row .btn.danger { flex: none; background: var(--danger-soft); color: #b91c1c; border-color: transparent; box-shadow: none; }

/* Bảo mật */
.pw-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 14px 24px 0; padding: 12px 16px; border-radius: var(--radius); background: var(--warning-soft); border: 1px solid #f5c27a; color: #7c4a03; font-size: 14px; }
.sec-score { display: flex; flex-direction: column; gap: 14px; }
.sec-score-main { display: flex; align-items: center; gap: 14px; }
.sec-score-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 26px; background: var(--success-soft); flex: none; }
.sec-score.warn .sec-score-ico { background: var(--warning-soft); } .sec-score.bad .sec-score-ico { background: var(--danger-soft); }
.sec-score-title { font-size: 20px; font-weight: 750; letter-spacing: -.01em; }
.sec-score-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.sec-meter { height: 8px; border-radius: 999px; background: #eef1f6; overflow: hidden; }
.sec-meter div { height: 100%; border-radius: 999px; background: var(--success); }
.sec-score.warn .sec-meter div { background: var(--warning); } .sec-score.bad .sec-meter div { background: var(--danger); }
.sec-checks { display: grid; grid-template-columns: minmax(0, 1fr); }
.sec-check { display: flex; align-items: center; gap: 12px; padding: 11px 4px; min-width: 0; }
.sec-check + .sec-check { border-top: 1px solid var(--viz-grid); }
.sec-ico { flex: none; width: 30px; text-align: center; font-size: 18px; }
.sec-text { flex: 1; min-width: 0; font-size: 13.5px; }
.sec-check .btn { flex: none; }
.sec-check.bad .sec-text .b { color: #b91c1c; }
.sec-policy { margin: 0; padding-left: 20px; display: grid; gap: 7px; font-size: 13.5px; color: var(--text-2); }
@media (max-width: 860px) { .pw-banner { margin: 12px 14px 0; } }

/* Danh sách cửa hàng */
.store-cell { display: flex; gap: 12px; align-items: flex-start; }
.store-code { flex: none; padding: 4px 8px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-weight: 750; font-size: 12.5px; letter-spacing: .02em; }
.store-cell .badge { margin-left: 4px; vertical-align: 1px; }
