/* CentriX Studio — trang quản trị đơn hàng */
:root {
  --ink: #0a0a1f; --ink-2: #4b4b5e; --ink-3: #8a8a99; --paper: #fbfaf7; --tile: #efeeea; --line: #e4e2dc;
  --lime: #e4ff3c; --orange: #ff5a1f; --black: #0a0a0a;
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font: 400 14.5px/1.5 var(--font); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p, ol { margin: 0; }
ol { padding: 0; list-style: none; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--ink-3); font-size: 13px; }
.wrap { width: min(1320px, 100% - 40px); margin: 0 auto; padding: 24px 0 64px; }

.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand img { width: 44px; height: 28px; object-fit: contain; }
.brand span { font-weight: 900; font-size: 18px; letter-spacing: .04em; line-height: 1; }
.brand small { display: block; margin-top: 3px; padding-left: .42em; text-align: center; font-size: 9px; font-weight: 600; letter-spacing: .42em; color: var(--ink-2); }

.btn { display: inline-flex; align-items: center; justify-content: center; height: 42px; padding: 0 18px; border-radius: 999px; font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap; transition: transform .15s, background .15s, color .15s, box-shadow .15s; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(.97); }
.btn--lime { background: var(--lime); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn--lime:hover { background: var(--ink); color: var(--lime); }
.btn--ink { background: var(--ink); color: #fff; }
.btn--ghost { box-shadow: inset 0 0 0 1.5px var(--line); }
.btn--ghost:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn--sm { height: 34px; padding: 0 14px; font-size: 13px; }

/* Đăng nhập */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: var(--tile); }
.login__box { width: min(400px, 100%); display: grid; gap: 14px; padding: 32px; border-radius: 22px; background: var(--paper); box-shadow: 0 24px 60px rgba(10, 10, 31, .12); }
.login h1 { margin-top: 8px; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.login label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.login input { height: 50px; padding: 0 14px; border: 0; border-radius: 12px; font-size: 16px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.login input:focus { outline: 0; box-shadow: inset 0 0 0 2px var(--ink); }
.login .btn { height: 50px; }
.err { padding: 10px 14px; border-radius: 10px; background: #fff0ea; color: #a8320a; font-size: 13.5px; font-weight: 500; }

/* Thanh trên */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; padding: 12px 20px; background: rgba(251, 250, 247, .94); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top__title { font-size: 15px; font-weight: 700; padding-left: 18px; border-left: 1px solid var(--line); }
.top__actions { display: flex; gap: 8px; margin-left: auto; }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #35c26a; animation: pulse 2s ease-in-out infinite; }
.live.is-err i { background: var(--orange); animation: none; }
.live.is-err { color: #a8320a; }
@keyframes pulse { 50% { opacity: .3; transform: scale(.7); } }

/* Số liệu */
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 16px 18px; border-radius: 16px; background: var(--tile); }
.stat span { display: block; font-size: 12.5px; color: var(--ink-2); }
.stat b { display: block; margin-top: 4px; font-size: 26px; font-weight: 900; letter-spacing: -.02em; line-height: 1.15; white-space: nowrap; }
.stat.is-hot { background: var(--lime); box-shadow: inset 0 0 0 1.5px var(--ink); }
.stat.is-hot span { color: var(--ink); font-weight: 600; }

/* Khối */
.panel { margin-top: 20px; padding: 20px; border-radius: 18px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 14px; }
.panel h2 { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.search { width: min(340px, 100%); height: 42px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--tile); }
.search:focus { outline: 0; box-shadow: inset 0 0 0 2px var(--ink); }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 8px 0 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.tabs b { min-width: 24px; padding: 2px 7px; border-radius: 999px; background: var(--tile); font-size: 12px; text-align: center; }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; box-shadow: none; }
.tabs button[aria-selected="true"] b { background: var(--lime); color: var(--ink); }
.empty { padding: 40px 0; text-align: center; color: var(--ink-3); }

/* Bảng */
.scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 12px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.tbl thead th { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.tbl small { display: block; font-size: 12.5px; color: var(--ink-3); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl--orders tbody tr { cursor: pointer; transition: background .15s; }
.tbl--orders tbody tr:hover { background: var(--paper); }
.tbl__foot td { font-size: 13.5px; color: var(--ink-2); }
.num { width: 120px; height: 36px; padding: 0 10px; border: 0; border-radius: 10px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.num--sm { width: 84px; }
.num:focus { outline: 0; box-shadow: inset 0 0 0 2px var(--ink); }
.left { font-size: 16px; }
.left.is-low { color: var(--orange); }
.left.is-out { padding: 3px 10px; border-radius: 999px; background: #fff0ea; color: #a8320a; font-size: 12.5px; }
.chip { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 9px; border-radius: 999px; background: var(--tile); font-size: 12.5px; white-space: nowrap; }
.pill { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.pill--new { background: var(--lime); box-shadow: inset 0 0 0 1.5px var(--ink); }
.pill--ok { background: #e3ecff; color: #1c3f9a; }
.pill--ship { background: #fff1d6; color: #7a4b00; }
.pill--done { background: #dff5e6; color: #14602f; }
.pill--off { background: var(--tile); color: var(--ink-3); text-decoration: line-through; }

/* Ngăn chi tiết */
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(10, 10, 31, .4); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 40; width: min(480px, 100%); display: flex; flex-direction: column; background: var(--paper); transform: translateX(100%); visibility: hidden; transition: transform .28s cubic-bezier(.2, .7, .2, 1), visibility .28s; }
.drawer.is-open { transform: none; visibility: visible; }
.drawer__head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer__head h3 { font-size: 22px; font-weight: 900; letter-spacing: .02em; }
.drawer__head .pill { margin-left: auto; }
.x { width: 38px; height: 38px; border-radius: 50%; font-size: 15px; }
.x:hover { background: var(--tile); }
.drawer__body { flex: 1; overflow-y: auto; padding: 18px 20px 28px; }
.drawer h4 { margin: 22px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.acts { display: flex; flex-wrap: wrap; gap: 8px; }
.acts .btn--lime { flex: 1; }
.card { display: grid; gap: 6px; justify-items: start; padding: 16px; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.card > a { font-weight: 700; font-size: 16px; }
.card .note { padding: 8px 12px; border-radius: 10px; background: #fff6d6; color: #6b4e00; font-size: 13.5px; }
.card .btn { margin-top: 6px; }
.row { width: 100%; display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.row small { display: block; color: var(--ink-3); font-size: 12.5px; }
.row--sub { color: var(--ink-2); font-size: 13.5px; padding: 2px 0; }
.row--sum { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 15px; }
.row--sum b { font-size: 20px; font-weight: 900; }
.drawer textarea { width: 100%; margin-bottom: 8px; padding: 12px 14px; border: 0; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); resize: vertical; }
.drawer textarea:focus { outline: 0; box-shadow: inset 0 0 0 2px var(--ink); }
.log { display: grid; gap: 10px; font-size: 13.5px; }
.log li { position: relative; padding-left: 18px; }
.log li::before { content: ''; position: absolute; left: 0; top: .5em; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 1.5px var(--ink); }
.log time { display: block; font-size: 12px; color: var(--ink-3); }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 60; max-width: calc(100% - 32px); padding: 12px 20px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 500; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* Điện thoại / máy tính bảng */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .top__title, #btn-notify { display: none; }
}
@media (max-width: 760px) {
  .wrap { width: calc(100% - 24px); padding-top: 14px; }
  .top { flex-wrap: wrap; gap: 8px 12px; padding: 10px 12px; }
  .live { order: 3; width: 100%; font-size: 12px; }
  .top__actions .btn { height: 36px; padding: 0 12px; font-size: 12.5px; }
  .top__actions a[target] { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 12px 14px; }
  .stat b { font-size: 21px; }
  .panel { padding: 14px; border-radius: 16px; }
  .search { width: 100%; font-size: 16px; }
  /* Bảng thành thẻ: mỗi dòng một thẻ, nhãn cột nằm bên trái */
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; }
  .tbl tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .tbl tbody tr:last-child { border-bottom: 0; }
  .tbl td { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 4px 0; border: 0; text-align: right; }
  .tbl td[data-l]::before { content: attr(data-l); flex: none; font-size: 12px; color: var(--ink-3); text-align: left; }
  .tbl td:not([data-l]) { justify-content: flex-end; padding-top: 8px; }
  .tbl td:not([data-l]) .btn { width: 100%; height: 40px; }
  .tbl td:empty { display: none; }
  .tbl__foot td { flex-wrap: wrap; justify-content: flex-start; text-align: left; }
  .num { font-size: 16px; }
}
