/* META Express – web khách hàng. Màu và nét chung theo trang admin (primary #626ed4). */
:root {
  --p: #2e2370; --p-d: #211958; --p-l: #eceaf7;
  --ink: #2a3042; --mut: #74788d; --line: #e3e6ef; --bg: #f4f5fa; --card: #fff;
  --ok: #1f9d6b; --ok-l: #e6f6ef; --warn: #b7791f; --warn-l: #fdf3dc; --err: #d64545; --err-l: #fdecec; --info: #2f7fd0; --info-l: #e7f1fc;
  --side: 232px; --r: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.5 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); -webkit-text-size-adjust: 100%; }
a { color: var(--p); }
h1, h2, h3 { margin: 0; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- Form ---------- */
/* Nhãn nổi trên viền ô nhập (kiểu Material) */
label.f { display: block; position: relative; margin-top: 7px; }
label.f > span { position: absolute; top: -9px; left: 9px; z-index: 1; padding: 0 5px; background: #fff; border-radius: 4px; font-size: 12px; line-height: 18px; color: var(--mut); max-width: calc(100% - 18px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
label.f:focus-within > span { color: var(--p); }
label.f > span.red { color: var(--err); }
label.f input, label.f select, label.f textarea { padding-top: 12px; padding-bottom: 10px; min-height: 46px; }
label.f > span b { color: var(--err); font-weight: 600; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid #cfd4e2; border-radius: 8px; background: #fff; min-height: 40px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--p-l); border-color: var(--p); }
input[type=file] { padding: 7px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid.g3 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; min-height: 40px; border: 1px solid var(--p); border-radius: 8px; background: var(--p); color: #fff; cursor: pointer; font-weight: 500; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--p-d); }
.btn.o { background: #fff; color: var(--p); } .btn.o:hover { background: var(--p-l); }
.btn.d { background: #fff; color: var(--err); border-color: var(--err); } .btn.d:hover { background: var(--err-l); }
.btn.s { padding: 5px 10px; min-height: 32px; font-size: 13.5px; }
.btn:disabled { opacity: .55; cursor: wait; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > .grow { flex: 1; min-width: 220px; }
.mt { margin-top: 14px; } .mut { color: var(--mut); font-size: 13.5px; }

/* ---------- Login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #eef0fb 0%, #f4f5fa 55%, #e9f3fb 100%); }
.login .box { width: 100%; max-width: 400px; background: #fff; border-radius: 14px; box-shadow: 0 10px 40px rgba(60, 70, 140, .13); overflow: hidden; }
.login .head { background: var(--p); color: #fff; padding: 26px 24px 22px; text-align: center; }
.mark { display: inline-grid; place-items: center; background: #fff; border-radius: 50%; }
.login .head .mark { width: 62px; height: 62px; margin-bottom: 10px; } .login .head .mark img { height: 32px; }
.login .head h1 { font-size: 20px; } .login .head p { margin: 4px 0 0; opacity: .85; font-size: 14px; }
.login form { padding: 22px 24px 26px; display: grid; gap: 14px; }
.pw { position: relative; } .pw button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--mut); cursor: pointer; padding: 6px 8px; font-size: 13px; }

/* ---------- Shell ---------- */
.shell { min-height: 100%; }
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); background: #2a3042; color: #a6b0cf; display: flex; flex-direction: column; z-index: 30; }
.side .brand { height: 62px; display: flex; align-items: center; gap: 10px; padding: 0 18px; color: #fff; font-weight: 600; font-size: 16px; }
.side .brand .mark { width: 34px; height: 34px; } .side .brand .mark img { height: 18px; }
.side nav { padding: 8px 10px; overflow-y: auto; flex: 1; }
.side nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 8px; color: inherit; text-decoration: none; margin-bottom: 2px; cursor: pointer; }
.side nav a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.side nav a.on { color: #fff; background: var(--p); }
.side nav svg, .tabbar svg { width: 19px; height: 19px; flex: none; }
.side .foot { padding: 12px 18px; font-size: 12.5px; border-top: 1px solid rgba(255, 255, 255, .08); }
.top { position: sticky; top: 0; z-index: 20; height: 62px; margin-left: var(--side); background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 22px; }
.top h1 { font-size: 18px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .user { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.top .ava { width: 34px; height: 34px; border-radius: 50%; background: var(--p-l); color: var(--p); display: grid; place-items: center; font-weight: 600; }
.top .burger { display: none; border: 0; background: none; padding: 6px; cursor: pointer; }
main { margin-left: var(--side); padding: 20px 22px 40px; max-width: 1280px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 16px; }
.card > h2 { font-size: 16px; margin-bottom: 12px; }
.tabbar { display: none; }
.scrim { display: none; }

/* ---------- Stats ---------- */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; cursor: pointer; border-left: 4px solid var(--p); }
.stat:hover { box-shadow: 0 4px 14px rgba(60, 70, 140, .1); }
.stat .n { font-size: 24px; font-weight: 600; line-height: 1.2; } .stat .l { color: var(--mut); font-size: 13.5px; }
.stat.ok { border-left-color: var(--ok); } .stat.warn { border-left-color: #e0a93b; } .stat.err { border-left-color: var(--err); } .stat.info { border-left-color: var(--info); }
.money { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.money div { background: var(--p-l); border-radius: 8px; padding: 12px 14px; } .money b { display: block; font-size: 18px; }

/* ---------- Table / list ---------- */
.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f8f9fc; color: var(--mut); font-weight: 600; font-size: 13px; white-space: nowrap; }
tbody tr.click { cursor: pointer; } tbody tr.click:hover { background: #fafbff; }
td.r, th.r { text-align: right; white-space: nowrap; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 500; background: var(--p-l); color: var(--p); white-space: nowrap; }
.badge.ok { background: var(--ok-l); color: var(--ok); } .badge.warn { background: var(--warn-l); color: var(--warn); } .badge.err { background: var(--err-l); color: var(--err); } .badge.info { background: var(--info-l); color: var(--info); } .badge.gray { background: #eef0f4; color: #666; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; -webkit-overflow-scrolling: touch; }
.chips button { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 6px 13px; cursor: pointer; font-size: 13.5px; }
.chips button.on { background: var(--p); color: #fff; border-color: var(--p); }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--mut); padding: 28px 10px; }
.alert { padding: 10px 12px; border-radius: 8px; margin-top: 12px; white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.alert.ok { background: var(--ok-l); color: #17724e; } .alert.err { background: var(--err-l); color: #a83232; } .alert.warn { background: var(--warn-l); color: #8a5a12; }
.ocards { display: none; }
.ocard { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: #fff; cursor: pointer; }
.ocard .h { display: flex; justify-content: space-between; gap: 8px; align-items: start; margin-bottom: 4px; }
.ocard .h b { word-break: break-all; }

/* ---------- Modal / toast ---------- */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(30, 34, 50, .5); display: grid; place-items: center; padding: 14px; }
.modal .dlg { background: #fff; border-radius: 12px; width: 100%; max-width: 620px; max-height: 92vh; overflow-y: auto; }
.modal .dh { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.modal .dh h2 { flex: 1; font-size: 16px; } .modal .dh button { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--mut); padding: 4px 8px; }
.modal .db { padding: 16px 18px; } .modal .df { padding: 12px 18px 16px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
dl.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; } dl.kv dt { color: var(--mut); } dl.kv dd { margin: 0; word-break: break-word; }
#toasts { position: fixed; z-index: 80; right: 16px; top: 16px; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { padding: 10px 14px; border-radius: 8px; color: #fff; background: #2a3042; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); font-size: 14px; white-space: pre-wrap; }
.toast.ok { background: var(--ok); } .toast.err { background: var(--err); }

/* ---------- Điện thoại / máy tính bảng ---------- */
@media (max-width: 900px) {
  .side { transform: translateX(-100%); transition: transform .2s; width: 260px; }
  .shell.open .side { transform: none; }
  .shell.open .scrim { display: block; position: fixed; inset: 0; background: rgba(30, 34, 50, .45); z-index: 25; }
  .top, main { margin-left: 0; }
  .top { padding: 0 12px; height: 56px; } .top h1 { font-size: 16.5px; } .top .burger { display: block; } .top .user span { display: none; }
  main { padding: 14px 12px calc(84px + env(safe-area-inset-bottom)); }
  .card { padding: 14px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 22; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: grid; justify-items: center; gap: 2px; padding: 8px 2px 7px; font-size: 11.5px; color: var(--mut); text-decoration: none; cursor: pointer; }
  .tabbar a.on { color: var(--p); }
  .tabbar a.plus span { background: var(--p); color: #fff; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; margin-top: -20px; box-shadow: 0 4px 12px rgba(98, 110, 212, .45); }
  .tabbar a.plus svg { width: 22px; height: 22px; }
  .otable { display: none; } .ocards { display: block; }
  dl.kv { grid-template-columns: 112px 1fr; }
  input, select, textarea { font-size: 16px; } /* tránh iOS tự phóng to khi gõ */
  #toasts { left: 12px; right: 12px; top: 10px; max-width: none; }
  .modal { padding: 0; align-items: end; } .modal .dlg { border-radius: 14px 14px 0 0; max-height: 94vh; }
}

/* ---------- Tạo đơn dạng tấm trượt ---------- */
.sheet { animation: sheetIn .22s ease-out; }
@keyframes sheetIn { from { transform: translateX(48px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheetbar { position: sticky; top: 62px; z-index: 15; display: flex; align-items: center; gap: 12px; margin: -4px 0 14px; padding: 10px 14px; background: var(--p); color: #fff; border-radius: 10px; box-shadow: 0 4px 14px rgba(46, 35, 112, .25); }
.sheetbar h2 { flex: 1; font-size: 17px; }
.sheetbar .x { border: 0; background: none; color: #fff; font-size: 26px; line-height: 1; cursor: pointer; padding: 0 6px; }
.sheetbar .btn { background: #fff; color: var(--p); border-color: #fff; font-weight: 600; }
.pbadge { position: absolute; right: 8px; top: 9px; padding: 3px 10px; border-radius: 14px; font-size: 11.5px; font-weight: 700; letter-spacing: .3px; color: #fff; background: #9aa0b4; }
.pbadge.safe { background: #2fa565; } .pbadge.warn { background: #d99114; } .pbadge.danger { background: #d64545; }
.feebox { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 14px; padding: 12px; background: var(--p-l); border-radius: 10px; }
.feebox div { font-size: 13px; color: var(--mut); } .feebox b { display: block; font-size: 17px; color: var(--ink); }
.track { list-style: none; margin: 10px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.track li { position: relative; padding: 0 0 12px 10px; font-size: 13.5px; }
.track li:before { content: ""; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.track li:first-child:before { background: var(--p); }
@media (max-width: 900px) { .sheetbar { top: 56px; } }
label.chk { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--mut); cursor: pointer; }
label.chk input { width: 18px; height: 18px; min-height: 0; padding: 0; }
.tkt { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.tmsg { margin: 6px 0; padding: 6px 10px; border-radius: 8px; background: #f3f4f8; font-size: 13.5px; }
.tmsg.employee { background: var(--p-l); }
