:root {
  --brand: #137a5a;
  --brand-d: #0e5f46;
  --brand-l: #e7f4ef;
  --ink: #1d2733;
  --muted: #667085;
  --line: #e3e7ec;
  --bg: #f4f6f8;
  --card: #fff;
  --red: #c0392b;
  --red-l: #fdecea;
  --amber: #b26a00;
  --amber-l: #fff4e0;
  --blue: #1f5fbf;
  --radius: 8px;
  font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }
.boot { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.red { color: var(--red); }
.green { color: var(--brand); }
.amber { color: var(--amber); }
.bold { font-weight: 600; }
.nowrap { white-space: nowrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 16px; }
@media (max-width: 700px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ---------- khung ---------- */
.layout { display: flex; min-height: 100vh; }
.side { width: 220px; background: #1e8a5e; color: #f2fbf6; flex-shrink: 0; display: flex; flex-direction: column; }
.side .logo { padding: 16px; font-weight: 700; color: #fff; font-size: 15px; display: flex; gap: 10px; align-items: center; }
.side .logo i { width: 28px; height: 28px; border-radius: 7px; background: #fff; color: #1e8a5e; display: inline-grid; place-items: center; font-style: normal; }
.side nav { flex: 1; overflow-y: auto; padding-bottom: 12px; }
.side .grp { padding: 14px 16px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #c8efda; }
.side a { display: block; padding: 7px 16px; color: #f2fbf6; border-left: 3px solid transparent; }
.side a:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.side a.on { background: rgba(255,255,255,.22); color: #fff; font-weight: 600; border-left-color: #fff; }
.side .me { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.25); font-size: 13px; }
.side .muted { color: #d6f3e4; }
.side .me a { padding: 2px 0; border: 0; display: inline; color: #ffffff; text-decoration: underline; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: none; }
.page { padding: 18px 22px 40px; }
.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h1 { flex: 1; }
@media (max-width: 900px) {
  .side { position: fixed; z-index: 50; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #1e8a5e; color: #fff; }
  .top button { background: none; border: 0; color: #fff; font-size: 22px; }
  .page { padding: 12px; }
}

/* ---------- thẻ, bảng ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card.p0 { padding: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 20px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; background: var(--card); }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl th { background: #f8fafb; font-weight: 600; font-size: 12px; color: #475467; white-space: nowrap; position: sticky; top: 0; }
.tbl tbody tr:hover { background: #fafcfb; }
.tbl tr.click { cursor: pointer; }
.tbl tfoot td { font-weight: 700; background: #f8fafb; }
.tbl tr.cancelled td { color: #98a2b3; text-decoration: line-through; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 12px; background: var(--brand-l); color: var(--brand-d); white-space: nowrap; }
.tag.red { background: var(--red-l); color: var(--red); }
.tag.amber { background: var(--amber-l); color: var(--amber); }
.tag.grey { background: #eef0f3; color: #475467; }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 10px; color: var(--muted); }

/* ---------- form ---------- */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { border: 1px solid #cfd5dc; border-radius: 6px; padding: 7px 10px; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(19,122,90,.25); border-color: var(--brand); }
input.num { text-align: right; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #475467; }
label.f > input, label.f > select, label.f > textarea { font-size: 14px; color: var(--ink); }
label.chk { display: inline-flex; align-items: center; gap: 6px; }
.btn { border: 1px solid #cfd5dc; background: #fff; padding: 7px 14px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f4f6f8; }
.btn.pri { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.pri:hover { background: var(--brand-d); }
.btn.danger { color: var(--red); border-color: #f1c0ba; }
.btn.big { padding: 12px 20px; font-size: 16px; font-weight: 600; }
.btn.sm { padding: 3px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.x { border: 0; background: none; color: #98a2b3; cursor: pointer; font-size: 18px; line-height: 1; }
.x:hover { color: var(--red); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: 0; background: none; padding: 8px 14px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* ---------- ô tìm có gợi ý ---------- */
.picker { position: relative; }
.picker input { width: 100%; }
.picker .drop { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 2px); background: #fff; border: 1px solid var(--line);
  border-radius: 6px; box-shadow: 0 8px 24px rgba(16,24,40,.12); max-height: 360px; overflow-y: auto; }
.picker .opt { padding: 7px 10px; cursor: pointer; display: flex; gap: 10px; justify-content: space-between; border-bottom: 1px solid #f2f4f7; }
.picker .opt.on, .picker .opt:hover { background: var(--brand-l); }
.picker .opt .sub { font-size: 12px; color: var(--muted); }

/* ---------- hộp thoại ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 100; display: grid; place-items: start center; padding: 40px 12px; overflow-y: auto; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 640px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal.wide { max-width: 980px; }
.modal-h { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-h h2 { margin: 0; flex: 1; }
.modal-b { padding: 16px 18px; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.toast { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast div { background: #1d2733; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 380px; }
.toast div.err { background: var(--red); }

/* ---------- đăng nhập ---------- */
.login { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #12302a, #137a5a); padding: 16px; }
.login .card { width: 100%; max-width: 360px; padding: 28px; }
.login h1 { margin-bottom: 4px; }
.login .stack input { width: 100%; }

/* ---------- màn hình bán hàng ---------- */
.pos-page { background: #f1faf4; flex: 1; } /* nền xanh lá nhạt cho màn hình bán hàng */
.pos { display: grid; grid-template-columns: 1fr 360px; gap: 14px; align-items: start; }
@media (max-width: 1000px) { .pos { grid-template-columns: 1fr; } }
.pos .cart td input { width: 90px; }
.pos .pay .line { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; gap: 10px; }
.pos .pay .line input { width: 150px; }
.pos .pay .total { font-size: 22px; font-weight: 700; color: var(--brand); }
.carts { display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap; }
.carts button { border: 1px solid var(--line); background: #fff; border-radius: 6px 6px 0 0; padding: 6px 12px; cursor: pointer; }
.carts button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.search-big input { font-size: 16px; padding: 11px 14px; }
.method { display: flex; gap: 6px; }
.method button { flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 7px; cursor: pointer; }
.method button.on { border-color: var(--brand); background: var(--brand-l); color: var(--brand-d); font-weight: 600; }

/* ---------- trang báo cáo ---------- */
.rep-layout { display: grid; grid-template-columns: 270px 1fr; gap: 14px; align-items: start; }
.rep-menu { padding: 8px 0; position: sticky; top: 10px; max-height: calc(100vh - 20px); overflow-y: auto; }
.rep-grp { padding: 10px 14px 4px; font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--brand-d); }
.rep-item { display: flex; align-items: center; gap: 6px; padding: 5px 14px; cursor: pointer; font-size: 13px; }
.rep-item:hover { background: #f6f8f7; }
.rep-item.on { background: var(--brand-l); font-weight: 600; }
.rep-main { min-width: 0; }
.rep-title { font-size: 17px; font-weight: 700; text-align: center; }
.rep-sub { text-align: center; margin-top: 2px; }
.rep-table { max-height: 70vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.tbl tr.rep-g td { font-weight: 700; background: #f3f7f5; }
.tbl tfoot td { position: sticky; bottom: 0; }
@media (max-width: 900px) { .rep-layout { grid-template-columns: 1fr; } .rep-menu { position: static; max-height: 260px; } }

/* ---------- biểu đồ cột đơn giản ---------- */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 170px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.bars .b i { display: block; width: 100%; max-width: 44px; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .b span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.bars .b em { font-size: 11px; font-style: normal; color: var(--ink); white-space: nowrap; }

@media print { body * { visibility: hidden; } }
