:root {
  --bg: #e7eef6;
  --bg-2: #d5e2f0;
  --surface: #f5f9fc;
  --ink: #122033;
  --muted: #5b6d82;
  --line: #b7c7d8;
  --accent: #0f4c81;
  --accent-2: #d97706;
  --ok: #0f7a4d;
  --wait: #b7791f;
  --danger: #b42318;
  --shadow: 0 10px 30px rgba(15, 76, 129, 0.1);
  --radius: 18px;
  --font: "Be Vietnam Pro", "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;
  --display: "Be Vietnam Pro", "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
  max-width: 100%;
}
body {
  min-height: 100dvh;
  max-width: 100%;
  overflow-x: clip;
  font-family: var(--font);
  color: var(--ink);
  touch-action: manipulation;
  overscroll-behavior: none;
  background:
    radial-gradient(circle at 8% -8%, #f6d9a8 0%, transparent 40%),
    radial-gradient(circle at 100% 0%, #9ec4ea 0%, transparent 38%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 16px max(12px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  position: relative;
  overflow-x: clip;
}
.app:has(#panel-ton),
.app:has(#panel-home),
.app:has(#panel-thongke),
.app:has(#panel-thuchi),
body[data-page="ton"] .app,
body[data-page="home"] .app,
body[data-page="thongke"] .app,
body[data-page="thuchi"] .app {
  max-width: 1120px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}
#panel-ton,
#panel-home,
#panel-thongke,
#panel-xuat,
#panel-nhan,
#panel-chinhanh,
[id^="panel-"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
#ton-list.list {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  min-width: 0;
}
.section-title > span {
  min-width: 0;
  word-break: break-word;
}

.hidden { display: none !important; }

body[data-page="login"] {
  background:
    radial-gradient(760px 420px at 85% 0%, rgba(147, 197, 253, 0.28) 0%, transparent 60%),
    radial-gradient(640px 360px at 10% 100%, rgba(254, 215, 170, 0.22) 0%, transparent 60%),
    linear-gradient(180deg, #f8fafc 0%, #eef4fa 100%);
}
body[data-page="login"] .app {
  max-width: none;
  width: 100%;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-wrap {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  display: grid;
  gap: 20px;
}
.brand { text-align: center; }
.brand-logo {
  display: block;
  width: 104px;
  height: 104px;
  margin: 0 auto;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 10px 28px rgba(15, 76, 129, 0.16);
}
.brand p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
#login-form.card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 26px 24px 24px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
  backdrop-filter: none;
}
#login-form .field { gap: 7px; margin-bottom: 16px; }
#login-form .field input { height: 44px; padding: 0 13px; font-size: 0.96rem; }
#login-form .remember-row { margin: 0 0 18px; font-size: 0.9rem; }
#login-form .btn-primary { width: 100%; height: 46px; font-size: 0.98rem; border-radius: 12px; }

.card {
  background: color-mix(in srgb, var(--surface) 92%, white);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  max-width: 100%;
  min-width: 0;
}

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.remember-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -2px 0 14px;
  font-size: 0.88rem;
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}
.remember-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--ink);
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.12);
}
.field input.cn-ma-auto,
.field input.cn-ma-auto:focus {
  background: #f1f5f9;
  color: #0f172a;
  font-weight: 750;
  letter-spacing: 0.04em;
  border-color: #cbd5e1;
  box-shadow: none;
  cursor: default;
}
.cn-add-card {
  padding: 18px 20px;
}
.cn-add-card .section-title {
  margin-bottom: 14px;
}
.cn-add-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}
.cn-add-grid .field {
  margin-bottom: 0;
  gap: 6px;
}
.cn-add-grid .field label {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.cn-add-grid .field input {
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
}
.cn-add-ten,
.cn-add-pin,
.cn-add-hint,
.cn-add-btn {
  grid-column: 1 / -1;
}
.cn-add-hint {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}
.cn-add-btn {
  width: 100%;
  height: 42px;
  margin-top: 2px;
}
@media (min-width: 720px) {
  .cn-add-grid {
    grid-template-columns: 112px 136px minmax(0, 1.35fr) minmax(0, 1.15fr);
    gap: 14px 12px;
  }
  .cn-add-ma { grid-column: 1; }
  .cn-add-user { grid-column: 2; }
  .cn-add-ten { grid-column: 3; }
  .cn-add-pin { grid-column: 4; }
  .cn-add-hint { grid-column: 1 / 4; align-self: center; margin: 0; }
  .cn-add-btn { grid-column: 4; width: 100%; margin: 0; }
}
.cn-branch-item {
  padding: 14px 16px;
}
.cn-branch-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 12px;
}
.cn-branch-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.cn-branch-title strong {
  font-size: 0.98rem;
  color: var(--ink);
}
.cn-branch-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.cn-branch-actions .btn {
  width: auto;
  padding: 6px 12px;
  min-height: 34px;
}
.cn-branch-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: end;
}
.cn-branch-fields .field {
  margin-bottom: 0;
  gap: 5px;
}
.cn-branch-fields .field:last-child {
  grid-column: 1 / -1;
}
.cn-branch-fields .field label {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.cn-branch-fields .field input {
  height: 40px;
  padding: 0 11px;
  border-radius: 10px;
  font-size: 0.92rem;
}
@media (min-width: 680px) {
  .cn-branch-fields {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.9fr) minmax(0, 1.2fr);
  }
  .cn-branch-fields .field:last-child {
    grid-column: auto;
  }
}
.money-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.money-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.12);
}
.money-input input {
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  flex: 1;
  min-width: 0;
}
.money-suffix {
  flex-shrink: 0;
  padding: 0 12px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  background: #eef3f8;
  align-self: stretch;
  display: grid;
  place-items: center;
  border-left: 1px solid var(--line);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 520px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}
.tt-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.tt-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
}
.tt-btn.active[data-tt="da_tt_han"],
.tt-btn.active[data-tt="da_tt"] {
  background: #dff3e8;
  border-color: #0f7a4d;
  color: #0f7a4d;
}
.tt-btn.active[data-tt="da_tt_cuoc"] {
  background: #e8f1fa;
  border-color: #0f4c81;
  color: #0f4c81;
}
.tt-status {
  margin-top: 6px !important;
  font-size: 0.78rem;
  font-weight: 600;
  color: #c2410c;
}
.tt-status.is-paid {
  color: #0f7a4d;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 13px 16px;
  font-weight: 700;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-warn { background: var(--accent-2); color: #fff; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-sm { width: auto; padding: 8px 12px; font-size: 0.85rem; border-radius: 10px; }
.btn-xoa-phieu,
.btn-sua-phieu {
  padding: 4px 10px !important;
  font-size: 0.72rem !important;
  width: auto !important;
  flex-shrink: 0;
}
.item-head-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 100%;
}
.xuat-submit-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.xuat-submit-row #btn-xuat-huy:not(.hidden) {
  width: 100%;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.hint {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  min-height: 32px;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.topbar-home {
  display: inline-flex;
  flex-shrink: 0;
  border-radius: 50%;
  line-height: 0;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.topbar-home:hover {
  transform: scale(1.06);
  box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.14);
}
.topbar-home:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, white);
  outline-offset: 2px;
}
.topbar-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}
.topbar h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-chip,
.app-menu-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  color: var(--muted);
  position: relative;
}
.app-menu-btn {
  appearance: none;
  border: 1px solid #dbe4ee;
  background: #fff;
  color: #0f4c81;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 32, 51, 0.04);
}
.app-menu-btn:active {
  background: #f1f5f9;
}
.app-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(15, 23, 42, 0.35);
}
.app-menu-backdrop[hidden],
.app-menu-panel[hidden] {
  display: none !important;
}
.app-menu-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  width: min(320px, 88vw);
  height: 100dvh;
  background: #fff;
  box-shadow: -12px 0 40px rgba(15, 32, 51, 0.18);
  padding: calc(14px + env(safe-area-inset-top)) 14px calc(18px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: appMenuIn 0.2s ease;
}
@keyframes appMenuIn {
  from { transform: translateX(12px); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}
.app-menu-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 6px 10px;
  border-bottom: 1px solid #eef2f7;
}
.app-menu-head strong {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 750;
}
.app-menu-role {
  font-size: 0.78rem;
  color: #64748b;
}
.app-menu-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow: auto;
}
.app-menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: #0f172a;
  font-weight: 650;
  font-size: 0.95rem;
}
.app-menu-link:hover,
.app-menu-link:active {
  background: #f1f5f9;
}
.app-menu-link.is-active {
  background: #e8f1fa;
  color: #0f4c81;
}
.app-menu-ico {
  display: grid;
  place-items: center;
  width: 28px;
  color: #0f4c81;
  flex: 0 0 auto;
}
.app-menu-pin {
  appearance: none;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  cursor: pointer;
}
.pin-sheet {
  z-index: 110;
}
.pin-sheet .pin-sheet-card {
  text-align: left;
}
.pin-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.pin-sheet-note {
  margin: 0 0 12px;
  font-size: 0.88rem;
  color: #475569;
}
.pin-sheet-err {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 0.85rem;
  font-weight: 650;
}
.pin-sheet-err[hidden] {
  display: none;
}
.app-menu-logout {
  appearance: none;
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #b91c1c;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  cursor: pointer;
}
.tabs.tabs-hidden,
#tabs[hidden] {
  display: none !important;
}
.stats.stats-ton-compact {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 8px;
}
.ton-kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 72px;
  padding: 8px 6px !important;
  text-align: center;
}
.ton-kpi-ico {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: #0f4c81;
  opacity: 0.9;
  flex: 0 0 auto;
}
.ton-kpi .value {
  font-size: 1.15rem !important;
  line-height: 1.1;
}
.ton-kpi .label {
  margin-top: 0;
  font-size: 0.68rem !important;
  font-weight: 650;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.ton-kpi.is-active {
  border-color: #93c5fd;
  background: #eff6ff;
}
.user-chip strong {
  display: inline;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-chip .btn {
  width: auto !important;
  margin: 0;
  padding: 4px 10px;
  font-size: 0.72rem;
  line-height: 1.2;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.stats.stats-3,
.stats.stats-4,
.stats.stats-5,
.stats.stats-6,
.dash-kpi.stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.stats.stats-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.stats.stats-3 .stat,
.stats.stats-4 .stat,
.stats.stats-6 .stat,
.dash-kpi.stats .stat {
  padding: 10px 8px 8px;
  text-align: center;
}
.stats.stats-3 .stat .value,
.stats.stats-4 .stat .value,
.stats.stats-6 .stat .value,
.dash-kpi.stats .stat .value {
  font-size: 1.35rem;
}
.stats.stats-3 .stat .label,
.stats.stats-4 .stat .label,
.stats.stats-6 .stat .label,
.dash-kpi.stats .stat .label {
  font-size: 0.65rem;
  margin-top: 4px;
}
.stats.stats-5 > .stat:last-child:nth-child(odd) {
  grid-column: auto;
}
@media (min-width: 640px) {
  .stats:not(.stats-3):not(.stats-4):not(.stats-5):not(.stats-6):not(.dash-kpi) {
    grid-template-columns: repeat(4, 1fr);
  }
  .stats.stats-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (min-width: 900px) {
  .stats.stats-5 {
    grid-template-columns: repeat(5, 1fr);
  }
}
.badge-return { background: #fff7ed; color: #c2410c; }
.badge-lot {
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
}

.feed-lot .feed-title { color: #0f172a; }
.feed-lot-hint {
  font-size: 0.72rem;
  color: #64748b;
}
.feed-item.is-clickable,
.feed-lot {
  cursor: pointer;
}
.feed-lot:active {
  background: #f8fafc;
}

.lot-group {
  margin: 8px 0 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.lot-group-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 6px;
  align-items: center;
  padding: 11px 12px;
  background: #fff;
  border-bottom: 1px solid transparent;
}
.lot-group.is-open .lot-group-head {
  border-bottom-color: #e2e8f0;
}
.lot-toggle {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.lot-toggle-ico {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  margin-top: 1px;
  border-radius: 7px;
  background: #eef2f7;
  position: relative;
}
.lot-toggle-ico::before {
  content: '';
  position: absolute;
  inset: 7px 5px 7px 6px;
  border-right: 2px solid #475569;
  border-bottom: 2px solid #475569;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}
.lot-group.is-open .lot-toggle-ico::before {
  transform: rotate(45deg);
  inset: 6px 5px 8px 6px;
}
.lot-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
  padding-right: 4px;
}
.lot-branch {
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.25;
  color: #0f172a;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lot-status {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  align-self: start;
  display: inline-flex;
  max-width: 100%;
}
.lot-status .badge {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 3px 8px;
  border-radius: 999px;
  line-height: 1.2;
  white-space: nowrap;
}
.lot-head-actions {
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
  align-self: center;
  margin-left: 0;
}
.lot-meta {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lot-total {
  font-weight: 800;
  color: #c2410c;
  font-variant-numeric: tabular-nums;
}
.lot-group.is-paid .lot-group-head {
  background: linear-gradient(180deg, #f3fdf7 0%, #ecfdf5 100%);
  border-bottom-color: #bbf7d0;
}
.lot-group.is-paid {
  border-color: #86efac;
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.12);
}
.lot-group.is-paid .lot-total {
  color: #15803d;
}
.lot-group.is-paid .lot-toggle-ico {
  background: #dcfce7;
}
.lot-group.is-paid .lot-toggle-ico::before {
  border-color: #15803d;
}
.badge-paid {
  background: #dcfce7;
  color: #15803d;
  font-weight: 700;
}
.badge-pay-wait {
  background: #fff7ed;
  color: #c2410c;
  font-weight: 700;
}
.badge-paid-partial {
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 700;
}
.lot-pay-thumb {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  max-width: 28px;
  max-height: 28px;
  flex: 0 0 28px;
  padding: 0;
  border: 1px solid #bbf7d0;
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
  cursor: zoom-in;
  line-height: 0;
}
.lot-pay-thumb img {
  width: 28px;
  height: 28px;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.lot-pay-btn {
  appearance: none;
  width: 34px;
  height: 34px;
  min-width: 34px;
  flex: 0 0 34px;
  padding: 0;
  margin: 0;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: #0f4c81;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.lot-pay-btn svg {
  width: 18px;
  height: 18px;
}
.lot-pay-btn:hover {
  border-color: #93c5fd;
  background: #f0f7ff;
}
.lot-group.is-paid .lot-pay-btn {
  border-color: #86efac;
  color: #15803d;
  background: #f0fdf4;
}
.pay-sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
}
.pay-sheet.show { display: flex; }
.pay-sheet-card {
  width: min(420px, 100%);
  max-height: min(84dvh, 740px);
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  padding: 16px 16px 20px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  text-align: center;
  margin: auto;
}
.pay-sheet-top {
  display: flex;
  text-align: left;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.pay-sheet-kicker {
  font-size: 0.75rem;
  font-weight: 650;
  color: #64748b;
}
.pay-sheet-title {
  margin: 2px 0 0;
  font-size: 1.05rem;
  font-weight: 750;
}
.pay-sheet-amount {
  margin-top: 4px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #c2410c;
}
.pay-sheet-lo {
  margin-top: 2px;
  font-size: 0.75rem;
  color: #64748b;
}
.pay-qr-wrap {
  display: flex;
  justify-content: center;
  padding: 8px;
  background: #f8fafc;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
}
.pay-qr {
  width: min(280px, 100%);
  height: auto;
  border-radius: 10px;
  background: #fff;
}
.pay-acc {
  margin-top: 12px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #0f172a;
}
.pay-acc span { color: #64748b; font-size: 0.82rem; }
.pay-proof {
  margin-top: 14px;
  text-align: left;
}
.pay-proof-label {
  font-size: 0.78rem;
  font-weight: 650;
  color: #64748b;
  margin-bottom: 6px;
}
.lot-head-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex: 0 0 auto;
}
.lot-head-actions .btn {
  width: auto !important;
  flex: 0 0 auto;
  white-space: nowrap;
}
.lot-group-body {
  display: none;
  padding: 6px 8px 10px;
}
.lot-group.is-open .lot-group-body {
  display: block;
}
.item-in-lot,
.ton-card-in-lot {
  border-radius: 10px;
  background: #fff;
}
.lot-group-ton {
  grid-column: 1 / -1;
}
.lot-group-ton .lot-group-body {
  display: none;
  padding: 8px;
}
.lot-group-ton.is-open .lot-group-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lot-group-ton.is-done:not(.is-paid) .lot-group-head {
  background: #f1f5f9;
  opacity: 0.78;
}
.lot-group-ton.is-done:not(.is-paid) .lot-toggle-text strong {
  color: #64748b;
}
.lot-group-ton.is-done:not(.is-paid) .lot-meta,
.lot-group-ton.is-done:not(.is-paid) .lot-total {
  color: #94a3b8;
}

.lo-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
}
.lo-sheet.show { display: flex; }
.lo-sheet-card {
  width: min(560px, 100%);
  max-height: min(84dvh, 720px);
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  padding: 14px 14px 18px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  margin: auto;
}
.lo-sheet-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.lo-sheet-kicker {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
}
.lo-sheet-title {
  margin: 2px 0 0;
  font-size: 1.05rem;
  font-weight: 750;
  color: #0f172a;
}
.lo-sheet-summary {
  margin-top: 4px;
  font-size: 0.84rem;
  font-weight: 650;
  color: #c2410c;
}
.lo-sheet-bulk {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.lo-sheet-bulk .ton-act-btn--bulk {
  flex: 1 1 100%;
  justify-content: center;
  min-height: 46px;
  font-size: 0.95rem;
  padding: 12px 16px;
}
.lo-sheet-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
@media (min-width: 720px) {
  .lo-sheet-card {
    border-radius: 18px;
  }
}

.stat {
  background: #fff;
  border-radius: 14px;
  padding: 12px 12px 10px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  min-width: 0;
}
button.stat-link {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
button.stat-link.ton-kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
button.stat-link:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
button.stat-link:active {
  transform: none;
}
button.stat-link.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(15, 76, 129, 0.12);
  background: #f0f6fc;
}
button.stat-link.is-active .value {
  color: var(--accent);
}
.stat .label {
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.2;
  margin-top: 6px;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.stat .value {
  margin-top: 0;
  font-family: var(--display);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
}
.stat.kpi-wait .value { color: #b45309; }
.stat.kpi-ph .value { color: #1d4ed8; }
.stat.kpi-from-ph .value { color: #c2410c; }
.stat.kpi-done .value { color: #15803d; }
.stat.kpi-warn .value { color: #b91c1c; }
.stat.stat-alert,
.stat.stat-blink,
.stat.stat-blink-orange {
  background: #fff !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.stat.stat-alert {
  border-color: #fdba74;
}
.stat.stat-alert .value {
  color: #c2410c;
}
.stat.stat-blink {
  border-color: #f87171;
  animation: canhBaoBlink 0.9s ease-in-out infinite;
}
.stat.stat-blink .value {
  color: #b91c1c !important;
  font-weight: 800;
}
.stat.stat-blink .label {
  color: #64748b !important;
  font-weight: 500;
}
@keyframes canhBaoBlink {
  0%, 100% {
    border-color: #fca5a5;
    box-shadow: 0 0 0 0 rgba(185, 28, 28, 0);
  }
  50% {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
  }
}
@media (prefers-reduced-motion: reduce) {
  .stat.stat-blink {
    animation: none;
    border-color: #ef4444;
  }
}
.stat.stat-blink-orange {
  border-color: #fb923c;
  animation: choNhapBlink 0.9s ease-in-out infinite;
}
.stat.stat-blink-orange .value {
  color: #c2410c !important;
  font-weight: 800;
}
.stat.stat-blink-orange .label {
  color: #64748b !important;
  font-weight: 500;
}
@keyframes choNhapBlink {
  0%, 100% {
    border-color: #fdba74;
    box-shadow: 0 0 0 0 rgba(234, 88, 12, 0);
  }
  50% {
    border-color: #ea580c;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.18);
  }
}
@media (prefers-reduced-motion: reduce) {
  .stat.stat-blink-orange {
    animation: none;
    border-color: #ea580c;
  }
}

/* Dashboard home */
.dash {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.dash-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.dash-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  min-height: 24px;
  min-width: 0;
  flex-wrap: wrap;
}
.dash-section-head h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  min-width: 0;
}
.dash-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 0;
  cursor: pointer;
  width: auto !important;
  line-height: 1.2;
}
.dash-link:hover { opacity: 0.85; }
.dash-meta {
  margin: 0 0 8px;
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
}
.dash-feed,
.dash-ton {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.dash-feed .ton-table-panel,
.dash-ton .ton-table-panel {
  gap: 0;
}
.dash-feed .ton-table-wrap,
.dash-ton .ton-table-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.dash-feed .ton-table-foot,
.dash-ton .ton-table-foot {
  padding: 8px 10px;
}
.dash-empty {
  padding: 16px 4px !important;
  font-size: 0.85rem;
}
.feed-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid #f1f5f9;
  min-height: 0;
}
.feed-item:first-child {
  border-top: 0;
  padding-top: 4px;
}
.feed-item:last-child { padding-bottom: 2px; }
.feed-time {
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
  padding-top: 3px;
  letter-spacing: 0.01em;
}
.feed-body { min-width: 0; }
.feed-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.feed-title {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.feed-sub {
  margin-top: 2px;
  font-size: 0.75rem;
  color: #64748b;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feed-bottom {
  margin-top: 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.feed-money-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}
.feed-price {
  font-size: 0.84rem;
  font-weight: 700;
  color: #c2410c;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.feed-meta {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
}
.feed-bottom .btn-xem-anh,
.ton-preview-body .btn-xem-anh {
  margin-top: 0;
  padding: 3px 8px;
  font-size: 0.7rem;
  border-radius: 8px;
  font-weight: 600;
}
.ton-preview-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid #f1f5f9;
  min-height: 0;
}
.ton-preview-item.is-clickable { cursor: pointer; }
.ton-preview-lot .feed-title { color: #0f172a; }
.ton-preview-item:first-child {
  border-top: 0;
  padding-top: 4px;
}
.ton-preview-item:last-child { padding-bottom: 2px; }
.feed-thumb.lot-thumb {
  font-size: 0.9rem;
  font-weight: 800;
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
  cursor: pointer;
}
.feed-thumb {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  padding: 0;
  position: relative;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.feed-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.feed-thumb.empty-thumb {
  color: #cbd5e1;
  font-size: 0.72rem;
  cursor: default;
  font-weight: 600;
}
.ton-preview-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ton-preview-body .feed-money-row {
  margin-top: 2px;
}
.branch-mini {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.branch-mini-item {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.branch-mini-item strong {
  display: block;
  font-size: 0.88rem;
}
.branch-mini-item span {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: #64748b;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.branch-compare-total {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}
.branch-compare-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}
.branch-compare-range {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 12px;
}
.branch-compare-range .btn {
  width: auto !important;
  flex: 0 0 auto;
}
.branch-compare-date {
  display: grid;
  gap: 4px;
  flex: 1 1 120px;
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}
.branch-compare-date input {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.85rem;
  width: 100%;
  min-width: 0;
}
.branch-compare-loading,
.branch-compare-empty {
  padding: 20px 8px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}
.branch-compare-sum {
  margin: 12px 0 0;
  font-size: 0.82rem;
  color: #64748b;
  text-align: center;
}
.branch-compare-sum strong {
  color: var(--accent);
  font-size: 1rem;
}

.branch-compare-chart {
  margin-top: 4px;
  padding: 8px 4px 0;
  border-top: 1px solid #f1f5f9;
}
.branch-cols {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 10px;
  min-height: 168px;
  padding: 8px 2px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.branch-col {
  flex: 0 0 auto;
  width: 64px;
  min-width: 56px;
  max-width: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 180px;
  justify-content: flex-end;
}
.branch-col-bar {
  width: 100%;
  max-width: 44px;
  min-height: 12px;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, #3b82f6, var(--accent));
  box-shadow: 0 4px 12px rgba(15, 76, 129, 0.18);
  transition: height 0.35s ease;
}
.branch-col-val {
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1;
}
.branch-col-name {
  font-size: 0.68rem;
  font-weight: 600;
  color: #64748b;
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
  max-width: 100%;
}

@media (min-width: 640px) {
  .branch-col {
    flex: 1 1 0;
    width: auto;
    min-width: 72px;
    height: 200px;
  }
  .branch-col-bar {
    max-width: 52px;
  }
  .branch-cols {
    justify-content: center;
    overflow-x: visible;
    min-height: 200px;
  }
}

@media (max-width: 720px) {
  .stats:not(.stats-3):not(.stats-4):not(.stats-5):not(.stats-6):not(.dash-kpi):not(.stats-ton-compact) {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
  }
  .stats.stats-ton-compact {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
  .stat {
    padding: 11px 10px 9px;
    border-radius: 14px;
  }
  .stat .value { font-size: 1.4rem; }
  .stat .label { font-size: 0.7rem; margin-top: 5px; }
  .dash-section {
    padding: 11px 12px;
    margin-bottom: 10px;
    border-radius: 14px;
  }
  .feed-item {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 6px 8px;
    padding: 9px 0;
  }
  .feed-time { font-size: 0.72rem; }
  .feed-title { font-size: 0.88rem; }
}

@media (max-width: 390px) {
  .stat .value { font-size: 1.28rem; }
  .dash-section { padding: 10px; }
  .feed-item { grid-template-columns: 34px minmax(0, 1fr); }
  .user-chip strong { max-width: 88px; }
}

@media (max-width: 360px) {
  .stat { padding: 10px 8px 8px; }
  .stat .value { font-size: 1.2rem; }
  .stat .label { font-size: 0.65rem; }
  .feed-title { font-size: 0.84rem; }
  .feed-price { font-size: 0.78rem; }
  .dash-section-head h3 { font-size: 0.85rem; }
  .dash-link { font-size: 0.72rem; }
}

@media (min-width: 900px) {
  .stats { gap: 12px; margin-bottom: 16px; }
  .stat { padding: 16px 14px 14px; }
  .stat .value { font-size: 1.75rem; }
  .stat .label { font-size: 0.76rem; margin-top: 8px; line-height: 1.25; }
  .dash {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
  }
  .dash > .dash-kpi,
  .dash > #stats,
  .dash > #branch-stats {
    grid-column: 1 / -1;
  }
  .dash-section {
    padding: 16px 18px;
    margin-bottom: 0;
    height: 100%;
  }
  .feed-item { padding: 12px 0; }
  .feed-title { font-size: 0.98rem; }
  .feed-price { font-size: 0.9rem; }
}

.ton-title-row {
  gap: 10px;
  align-items: center;
}
.ton-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 8px;
  margin: 2px 0 12px;
}
.ton-toolbar.ton-toolbar--sdt-only {
  grid-template-columns: 1fr;
}
.ton-filter-card,
.ton-branch-field,
.ton-sdt-field {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 7px 8px 7px 10px;
  border: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  cursor: pointer;
}
.ton-branch-ico {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: #eef5fb;
  color: var(--accent);
  flex-shrink: 0;
}
.ton-sdt-ico {
  background: #fff7ed;
  color: #c2410c;
}
.ton-branch-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
  flex: 1;
}
.ton-branch-label {
  font-size: 0.62rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.2;
}
.ton-branch-select,
.ton-sdt-field input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}
.ton-branch-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6d82' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  background-size: 14px;
  padding-right: 18px;
}
.ton-sdt-field input::placeholder {
  color: #94a3b8;
  font-weight: 600;
}
.ton-branch-select:focus,
.ton-sdt-field input:focus {
  outline: none;
}
.ton-filter-card:focus-within,
.ton-branch-field:focus-within,
.ton-sdt-field:focus-within {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.12);
}
@media (max-width: 380px) {
  .ton-toolbar:not(.ton-toolbar--sdt-only) {
    grid-template-columns: 1fr;
  }
  .ton-branch-ico { width: 30px; height: 30px; }
  .ton-branch-select,
  .ton-sdt-field input { font-size: 0.88rem; }
}
.tk-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 12px;
  align-items: center;
}
.tk-filters .ton-branch-select {
  appearance: auto;
  background-image: none;
  max-width: none;
  flex: 1 1 160px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background-color: #fff;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
}
.tk-filters #tk-sdt {
  flex: 1 1 120px;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.85rem;
  margin: 0;
}

.list { display: grid; gap: 10px; }
.item {
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--line) 65%, transparent);
  border-radius: 16px;
  padding: 14px;
}
.item-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 6px;
  min-width: 0;
  flex-wrap: wrap;
}
.item-head strong { font-size: 0.98rem; }
.meta { color: var(--muted); font-size: 0.8rem; line-height: 1.45; }
.vot-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  margin-top: 4px;
}
.vot-meta div {
  background: #f3f7fb;
  border-radius: 10px;
  padding: 8px 10px;
}
.vot-meta div.full { grid-column: 1 / -1; }
.vot-meta span {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 2px;
}
.vot-meta b {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
  word-break: break-word;
}

.filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.filter-chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 700;
}
.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.chi-tiet { margin-top: 8px; font-size: 0.9rem; }

.field-hint {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.85em;
}
.anh-pick-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.anh-pick-row .btn {
  width: auto !important;
  flex: 1 1 140px;
}
.anh-previews {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.anh-previews:empty {
  display: none;
}
.anh-preview {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #e8eef4;
}
.anh-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.anh-preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(20, 30, 40, 0.72);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.btn-xem-anh {
  width: auto !important;
  margin-top: 8px;
}

.anh-viewer {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(10, 20, 30, 0.88);
  padding: 20px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
}
.anh-viewer.show {
  display: flex;
}
.anh-viewer img {
  max-width: min(920px, 100%);
  max-height: calc(100dvh - 120px);
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
}
.anh-viewer-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.anh-viewer-nav .btn {
  width: auto !important;
  min-width: 72px;
}
.anh-viewer-count {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
}
.anh-viewer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  color: #fff;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
}

.cam-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #0a121a;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}
.cam-overlay.show {
  display: flex;
}
.cam-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  padding-top: max(12px, env(safe-area-inset-top));
  color: #fff;
  font-weight: 700;
}
.cam-top .btn {
  width: auto !important;
}
.cam-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cam-stage video,
.cam-stage canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.cam-stage canvas {
  display: none;
}
.cam-stage.previewing video {
  display: none;
}
.cam-stage.previewing canvas {
  display: block;
}
.cam-actions {
  display: flex;
  gap: 10px;
  padding: 14px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  background: #111b24;
}
.cam-actions .btn {
  flex: 1;
}
.cam-actions .btn-snap {
  flex: 1.4;
}

.item-compact {
  padding: 10px 12px !important;
}
.item.is-clickable,
.item-compact.is-clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.item.is-clickable:hover,
.item-compact.is-clickable:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 10px rgba(15, 76, 129, 0.08);
}
.item-compact .item-head {
  margin-bottom: 4px;
  gap: 8px;
  align-items: flex-start;
}
.item-compact .compact-title {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 6px;
}
.item-compact .compact-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}
.item-compact .compact-title strong {
  display: inline;
  font-size: 1.05rem;
  line-height: 1.3;
  font-weight: 750;
}
.item-compact .compact-gia {
  font-size: 0.98rem;
  font-weight: 750;
  color: #c2410c;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.item-compact .compact-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.item-compact .compact-fact {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-size: 0.84rem;
  color: #334155;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}
.item-compact .compact-fact em {
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 650;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.item-compact .compact-fact--note {
  flex: 1 1 100%;
  font-weight: 500;
  color: #475569;
}
.item-compact .compact-note {
  display: block;
  flex-basis: 100%;
  margin-top: 2px;
  font-size: 0.84rem;
  color: #475569;
  font-weight: 500;
  line-height: 1.4;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  word-break: break-word;
}
.anh-grid {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  width: 100%;
}
.anh-grid-1 { grid-template-columns: minmax(0, 140px); }
.anh-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 280px; }
.anh-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 320px; }
.anh-grid-item {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
  cursor: zoom-in;
}
.anh-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.item-in-lot .anh-grid-1 { grid-template-columns: minmax(0, 120px); }
.item-compact .meta-line {
  display: none;
}
.item-compact .badge {
  font-size: 0.72rem;
  padding: 5px 9px;
  white-space: nowrap;
}
.item-compact .compact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
  justify-content: flex-end;
}
.item-compact .compact-actions:empty {
  display: none;
}
.item-compact .btn-xem-anh {
  margin-top: 0;
  padding: 4px 8px;
  font-size: 0.72rem;
}
.ton-act-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto !important;
  min-height: 40px;
  padding: 10px 16px !important;
  font-size: 0.9rem !important;
  font-weight: 750 !important;
  border-radius: 999px !important;
  line-height: 1.1;
}
.ton-act-btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}
.ton-act-btn span {
  white-space: nowrap;
}
.item-compact .compact-actions .ton-act-btn {
  min-width: 132px;
}
.journey-compact {
  margin: 6px 0 8px !important;
  padding: 8px !important;
}
.journey-compact .journey-steps {
  margin-bottom: 6px;
}
.journey-compact .step {
  font-size: 0.62rem !important;
  padding: 3px 2px !important;
}
.compact-code {
  text-align: center;
}
.compact-code code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 8px;
  display: inline-block;
}
.compact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 0.78rem;
  color: var(--muted);
}
.compact-meta .note {
  color: var(--ink);
  font-weight: 600;
  flex: 1 1 100%;
}
.compact-meta .gia {
  color: var(--accent, #c45c26);
  font-weight: 700;
}
.item-compact .row-actions {
  margin-top: 8px;
}

.journey-timeline {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
}
.journey-timeline-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.journey-timeline-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.journey-step {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  position: relative;
  padding-bottom: 12px;
}
.journey-step:last-child { padding-bottom: 0; }
.journey-step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 14px;
  bottom: 0;
  width: 2px;
  background: #e2e8f0;
}
.journey-step.is-done:not(:last-child)::before {
  background: color-mix(in srgb, var(--accent) 35%, #e2e8f0);
}
.journey-dot {
  width: 12px;
  height: 12px;
  margin-top: 3px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: #fff;
  justify-self: center;
}
.journey-step.is-done .journey-dot {
  border-color: var(--accent);
  background: var(--accent);
}
.journey-step.is-active .journey-dot {
  border-color: var(--accent-2);
  background: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18);
}
.journey-step-body {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.journey-step-body strong {
  font-size: 0.86rem;
  color: var(--ink);
  font-weight: 700;
}
.journey-step-body span {
  font-size: 0.78rem;
  color: #64748b;
}
.journey-step.is-active .journey-step-body strong {
  color: var(--accent);
}

.thumb-lg {
  width: 100%;
  max-height: 180px;
  border-radius: 12px;
  object-fit: cover;
  margin-top: 10px;
  border: 1px solid var(--line);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-wait { background: #fff7ed; color: #c2410c; }
.badge-ph { background: #eff6ff; color: #1d4ed8; }
.badge-ok { background: #eff6ff; color: #1d4ed8; }
.badge-done { background: #f0fdf4; color: #15803d; }

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2px;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(14px, env(safe-area-inset-bottom));
  width: min(480px, calc(100vw - 20px));
  max-width: calc(100% - 16px);
  z-index: 40;
  padding: 5px;
  background: #fff;
  border: 0;
  border-radius: 999px;
  box-shadow:
    0 1px 2px rgba(15, 32, 51, 0.04),
    0 10px 28px rgba(15, 76, 129, 0.12);
}
.tab {
  appearance: none;
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 10px 4px;
  min-height: 42px;
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: #64748b;
  white-space: normal;
  line-height: 1.15;
  text-decoration: none;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.tabs-many .tab {
  font-size: 0.68rem;
  padding: 8px 2px;
  min-height: 44px;
}
.tab:active:not(.active) {
  background: #f1f5f9;
}
.tab.active {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(15, 76, 129, 0.28);
}
.tab:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, white);
  outline-offset: 2px;
}

[id^="panel-"] {
  min-height: calc(100dvh - 120px);
}
.page-enter {
  animation: pageEnter 0.22s ease;
}
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 390px) {
  .tabs {
    width: calc(100% - 20px);
    padding: 4px;
    bottom: max(10px, env(safe-area-inset-bottom));
  }
  .tab {
    padding: 10px 4px;
    min-height: 40px;
    font-size: 0.76rem;
  }
}

@media (max-width: 360px) {
  .tab {
    padding: 9px 2px;
    font-size: 0.72rem;
  }
}

@media (min-width: 900px) {
  .tabs {
    width: min(520px, calc(100% - 40px));
    padding: 6px;
  }
  .tab {
    padding: 12px 14px;
    font-size: 0.88rem;
  }
}

.row-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.cn-actions .btn {
  width: auto !important;
  flex: 1 1 140px;
}

.product-row {
  display: grid;
  grid-template-columns: 56px 1fr 88px;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.product-row:last-child { border-bottom: 0; }
.product-row .name { font-weight: 600; font-size: 0.92rem; }
.product-row .ton { color: var(--muted); font-size: 0.78rem; margin-top: 2px; }
.product-row input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

.flash {
  display: none;
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(420px, calc(100% - 32px));
  background: var(--danger);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  z-index: 50;
  font-size: 0.86rem;
  text-align: center;
  box-shadow: var(--shadow);
  pointer-events: none;
}
.flash.show { display: block; }

.pull-refresh {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: 50%;
  z-index: 80;
  pointer-events: none;
  opacity: var(--pull-opacity, 0);
  transform: translateX(-50%) translateY(var(--pull-y, 0));
  transition: opacity 0.12s ease;
}
.pull-refresh-spin {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid #dbe7f3;
  border-top-color: var(--accent);
  transform: rotate(var(--pull-rot, 0deg));
}
.pull-refresh.ready .pull-refresh-spin {
  animation: pageSpin 0.7s linear infinite;
  transform: none;
}

.page-loader {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 75;
  align-items: center;
  justify-content: center;
  background: rgba(231, 238, 246, 0.55);
  backdrop-filter: blur(2px);
  pointer-events: all;
}
.page-loader.show {
  display: flex;
}
.page-loader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 22px 28px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 12px 36px rgba(15, 76, 129, 0.14);
  min-width: 120px;
}
.page-loader-spin {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid #dbe7f3;
  border-top-color: var(--accent);
  animation: pageSpin 0.7s linear infinite;
}
.page-loader-text {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: -0.01em;
}
.action-toast {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 160;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.28);
  pointer-events: all;
}
.action-toast.show {
  display: flex;
}
.action-toast-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: 148px;
  padding: 22px 26px;
  border-radius: 18px;
  background: #0f172a;
  color: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.35);
}
.action-toast-spin {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  animation: pageSpin 0.7s linear infinite;
}
.action-toast.is-done .action-toast-spin {
  animation: none;
  border: none;
  background: #16a34a;
}
.action-toast.is-done .action-toast-spin::after {
  content: '';
  display: block;
  width: 8px;
  height: 14px;
  margin: 6px auto 0;
  border: solid #fff;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}
@keyframes pageSpin {
  to { transform: rotate(360deg); }
}
body.is-loading {
  cursor: progress;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
  font-size: 0.92rem;
}

/* Mã vạch + hành trình */
.barcode {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px 6px;
  display: inline-block;
  max-width: 100%;
}
.barcode-bars {
  display: flex;
  align-items: flex-end;
  height: 42px;
  gap: 0;
  overflow: hidden;
}
.barcode-bars i {
  display: block;
  width: 2px;
  height: 100%;
  flex: 0 0 2px;
}
.barcode-bars i.on { background: #111; }
.barcode-bars i.off { background: transparent; width: 1.5px; flex-basis: 1.5px; }
.barcode-bars i.on {
  animation: barPulse 1.6s ease-in-out infinite;
}
@keyframes barPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.72; }
}
.barcode-text {
  margin-top: 4px;
  text-align: center;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--ink);
  font-weight: 700;
}

.journey {
  margin: 10px 0 12px;
  padding: 10px;
  border-radius: 14px;
  background: linear-gradient(90deg, #eef5fb, #f7fafc 50%, #eef8f1);
  border: 1px dashed color-mix(in srgb, var(--line) 80%, transparent);
}
.journey-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 10px;
}
.journey-in .journey-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.journey-steps .step {
  text-align: center;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--muted);
  padding: 4px 2px;
  border-radius: 8px;
  background: rgba(255,255,255,0.55);
  white-space: normal;
  line-height: 1.15;
  word-break: break-word;
  overflow-wrap: anywhere;
}
@media (min-width: 480px) {
  .journey-steps .step {
    font-size: 0.68rem;
  }
}
.journey-steps .step.active { color: var(--accent); background: #dceaf7; }
.journey-steps .step.done { color: var(--ok); background: #dff3e8; }

.journey-track,
.journey-marker {
  display: none !important;
}

#pwa-install-banner {
  display: none;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 84px;
  width: min(448px, calc(100% - 24px));
  background: #0b3a63;
  color: #fff;
  border-radius: 16px;
  padding: 12px 14px;
  z-index: 30;
  box-shadow: var(--shadow);
}
#pwa-install-banner.show { display: block; }
#pwa-install-banner p { margin: 0 0 10px; font-size: 0.86rem; line-height: 1.4; }
#pwa-install-banner .row-actions { margin: 0; }
#pwa-install-banner .btn { width: auto; }

.sheet-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
  margin-bottom: 8px;
  width: 100%;
}

.ton-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.ton-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.82rem;
}
.ton-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.ton-table tbody td {
  padding: 10px;
  border-bottom: 1px solid #eef2f7;
  vertical-align: middle;
  color: var(--ink);
}
.ton-table tbody tr.is-clickable {
  cursor: pointer;
  transition: background 0.12s ease;
}
.ton-table tbody tr.is-clickable:hover td {
  background: #f8fbff;
}
.ton-table tbody tr.is-paid td {
  background: #f3fdf7;
}
.ton-table tbody tr.is-paid:hover td {
  background: #ecfdf5;
}
.ton-table tbody tr.is-done:not(.is-paid) td {
  opacity: 0.72;
  background: #f8fafc;
}
.ton-th-stt,
.ton-td-stt {
  width: 26px;
  text-align: center;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.ton-th-branch,
.ton-td-branch {
  width: 28%;
  min-width: 0;
}
.ton-th-qty,
.ton-td-qty {
  width: 36px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.ton-th-qty {
  font-weight: 700;
}
.ton-td-qty {
  font-weight: 500;
}
.ton-th-money,
.ton-td-money {
  width: 96px;
  text-align: right;
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  padding-left: 4px;
  padding-right: 6px;
  letter-spacing: -0.03em;
}
.ton-th-money {
  font-weight: 700;
}
.ton-td-money {
  font-weight: 500;
}
.ton-table tr.is-paid .ton-td-money {
  color: #15803d;
}
.ton-td-money .ton-money-total {
  display: block;
}
.ton-td-money .ton-money-paid {
  display: block;
  margin-top: 3px;
  font-size: 0.78em;
  font-weight: 700;
  color: #15803d;
}
.ton-th-status,
.ton-td-status {
  width: 108px;
}
.ton-table-panel {
  display: grid;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
.ton-tt-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.ton-tt-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.ton-tt-filter-label {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
  white-space: nowrap;
}
.ton-tt-filter select {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  appearance: none;
  border: 0;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right center;
  background-size: 12px;
  padding: 0 18px 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.25;
  cursor: pointer;
}
.ton-tt-filter select:focus {
  outline: none;
}
.ton-tt-bar-hint {
  display: none;
}
.ton-tr-empty td {
  padding: 0;
}
.ton-tr-empty .empty {
  margin: 12px;
  padding: 16px;
}
.ton-th-act,
.ton-td-act {
  width: 44px;
  min-width: 40px;
  text-align: right;
  white-space: nowrap;
}
.ton-td-branch .lot-branch {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ton-td-sub {
  display: block;
  margin-top: 2px;
  font-size: 0.66rem;
  color: #94a3b8;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ton-st {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  padding: 4px 6px !important;
  line-height: 1.15;
  border: 0;
  font: inherit;
  font-size: 0.62rem !important;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
  text-align: left;
}
.ton-st span {
  min-width: 0;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
button.ton-st-pay {
  cursor: pointer;
  appearance: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
button.ton-st-pay:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}
button.ton-st-pay:active {
  transform: scale(0.98);
}
.ton-st svg {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
}
.ton-td-act {
  white-space: nowrap;
}
.ton-td-act .lot-pay-btn,
.ton-td-act .btn {
  vertical-align: middle;
}
.ton-td-act .lot-pay-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  flex-basis: 30px;
}
.ton-td-act .btn,
.ton-td-act .ton-act-bulk {
  width: auto !important;
  min-width: 0;
  padding: 6px 9px;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.15;
  margin-left: 2px;
  border-radius: 999px;
}
.ton-td-act-empty {
  color: #cbd5e1;
  font-weight: 600;
}
.ton-table tfoot td {
  padding: 0;
  border-bottom: 0;
  background: #f8fafc;
}
.ton-table-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 10px 12px;
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
}
.ton-table-foot strong {
  color: var(--ink);
  font-weight: 750;
}
@media (max-width: 520px) {
  .ton-table {
    font-size: 0.74rem;
  }
  .ton-th-stt,
  .ton-td-stt {
    width: 20px;
    padding-left: 4px;
    padding-right: 2px;
  }
  .ton-th-branch,
  .ton-td-branch {
    width: 30%;
  }
  .ton-th-qty,
  .ton-td-qty {
    width: 28px;
    padding-left: 2px;
    padding-right: 2px;
  }
  .ton-th-money,
  .ton-td-money {
    width: 84px;
    font-size: 0.7rem;
    padding-left: 2px;
    padding-right: 4px;
  }
  .ton-th-status,
  .ton-td-status {
    width: 92px;
    padding-left: 2px;
    padding-right: 2px;
  }
  .ton-th-act,
  .ton-td-act {
    width: 40px;
    min-width: 36px;
    padding-left: 2px;
    padding-right: 4px;
  }
  .ton-tt-filter {
    padding: 7px 10px;
  }
  .ton-tt-filter-label {
    font-size: 0.7rem;
  }
  .ton-tt-filter select {
    font-size: 0.78rem;
  }
  .ton-th-status {
    font-size: 0.58rem;
  }
  .ton-table thead th,
  .ton-table tbody td {
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .ton-td-branch .lot-branch {
    font-size: 0.72rem;
    letter-spacing: 0.01em;
  }
  .ton-td-sub {
    display: none;
  }
  .ton-st {
    padding: 2px 4px !important;
    gap: 2px;
  }
  .ton-st svg {
    width: 10px;
    height: 10px;
  }
  .ton-td-act .lot-pay-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
  }
  .ton-td-act .btn,
  .ton-td-act .ton-act-bulk {
    padding: 5px 8px;
    font-size: 0.7rem;
  }
}

.ton-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.ton-card {
  display: grid;
  grid-template-columns: 44px 52px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.ton-card.is-clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ton-card.is-clickable:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.ton-stt-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: 4px;
  min-width: 0;
}
.ton-card .stt-btn {
  margin-top: 0;
  font-size: 1rem;
  padding: 4px 2px;
  min-width: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: inherit;
  pointer-events: none;
}
.ton-stt-branch {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #64748b;
  text-align: center;
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ton-card-thumb {
  position: relative;
  display: inline-flex;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  background: #f1f5f9;
  cursor: zoom-in;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 600;
}
.ton-card-thumb.is-empty {
  cursor: default;
}
.ton-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ton-card-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.ton-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.ton-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--ink);
  word-break: break-word;
}
.ton-card-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  font-size: 0.8rem;
  color: #475569;
  font-weight: 500;
}
.ton-card-phone {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.ton-card-note {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  word-break: break-word;
}
.ton-card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  font-size: 0.74rem;
  color: #64748b;
  margin-top: 2px;
}
.ton-card-foot .dot,
.ton-card-sub .dot {
  opacity: 0.55;
}
.ton-card-pay {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: 0;
  width: 100%;
}
@media (min-width: 480px) {
  .ton-card-pay {
    margin-left: auto;
    width: auto;
  }
}
.ton-card-price {
  font-weight: 800;
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
}
.ton-card-act {
  margin-top: 8px;
}
.ton-card-act .btn {
  width: auto !important;
  min-width: 88px;
}
.ton-card.is-done {
  opacity: 0.48;
  filter: grayscale(0.35);
  background: #f1f5f9;
  border-color: #e2e8f0;
  box-shadow: none;
}
.ton-card.is-done .stt-btn {
  color: #94a3b8;
}
.ton-card.is-done .ton-stt-branch {
  color: #94a3b8;
}
.ton-card.is-done .ton-card-title,
.ton-card.is-done .ton-card-note {
  color: #64748b;
}
.ton-card-done-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
}

@media (max-width: 390px) {
  .ton-card {
    grid-template-columns: 40px 46px minmax(0, 1fr);
    gap: 8px;
    padding: 10px;
  }
  .ton-card-thumb {
    width: 46px;
    height: 46px;
    border-radius: 10px;
  }
  .ton-card-title {
    font-size: 0.9rem;
  }
  .ton-card-pay {
    margin-left: 0;
    width: 100%;
    margin-top: 2px;
  }
}

@media (min-width: 900px) {
  .stats.stats-ton-compact {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 10px;
  }
  .ton-kpi {
    min-height: 88px;
    padding: 12px 8px !important;
  }
  .ton-kpi .value {
    font-size: 1.4rem !important;
  }
  .ton-toolbar:not(.ton-toolbar--sdt-only) {
    grid-template-columns: minmax(280px, 1.4fr) minmax(220px, 0.8fr);
    gap: 10px;
    margin-bottom: 14px;
  }
  .ton-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
  }
  .ton-cards > .ton-card,
  .ton-cards > .lot-group-ton:not(.is-open) {
    height: 152px;
    min-height: 152px;
    max-height: 152px;
    margin: 0;
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
  }
  .ton-cards > .lot-group-ton {
    grid-column: auto;
    display: flex;
    flex-direction: column;
    margin: 0;
    min-width: 0;
  }
  .ton-cards > .lot-group-ton.is-open {
    height: auto;
    max-height: none;
    min-height: 152px;
    overflow: visible;
  }
  .ton-cards > .lot-group-ton:not(.is-open) .lot-group-head {
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: #fff;
  }
  .ton-cards > .lot-group-ton.is-paid:not(.is-open) .lot-group-head {
    background: #ecfdf5;
  }
  .ton-cards > .lot-group-ton:not(.is-open) .lot-toggle {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    align-items: center;
  }
  .ton-cards > .lot-group-ton:not(.is-open) .lot-toggle-ico {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }
  .ton-cards > .lot-group-ton:not(.is-open) .lot-toggle-text {
    gap: 6px;
  }
  .ton-cards > .lot-group-ton:not(.is-open) .lot-toggle-text strong {
    font-size: 1.02rem;
    line-height: 1.2;
  }
  .ton-cards > .lot-group-ton:not(.is-open) .lot-meta {
    font-size: 0.88rem;
    white-space: normal;
    line-height: 1.35;
  }
  .ton-cards > .lot-group-ton:not(.is-open) .lot-total {
    font-size: 1.05rem;
  }
  .ton-cards > .lot-group-ton:not(.is-open) .lot-head-actions {
    margin-left: 0;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
  }
  .ton-cards > .lot-group-ton:not(.is-open) .lot-pay-thumb {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    max-width: 32px;
    max-height: 32px;
    flex-basis: 32px;
  }
  .ton-cards > .lot-group-ton:not(.is-open) .lot-pay-thumb img {
    width: 32px;
    height: 32px;
  }
  .ton-card {
    padding: 14px;
    align-items: stretch;
  }
  .ton-card-main {
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-content: start;
    overflow: hidden;
  }
  .ton-card-title {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .ton-card-note {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .ton-card-act {
    margin-top: auto;
    padding-top: 4px;
  }
}

.sheet {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.62rem;
  line-height: 1.2;
}
.sheet th,
.sheet td {
  border-bottom: 1px solid #e2eaf2;
  border-right: 1px solid #eef3f8;
  padding: 4px 3px;
  text-align: left;
  vertical-align: middle;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.sheet th:last-child,
.sheet td:last-child {
  border-right: 0;
}
.sheet thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef4fa;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.58rem;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  padding: 5px 3px;
}
.sheet tbody tr:nth-child(even) td {
  background: #f8fafc;
}
.sheet tbody tr:hover td {
  background: #eef6ff;
}
.sheet td.num {
  text-align: center;
  font-weight: 700;
  width: 36px;
  white-space: nowrap;
  padding: 2px;
}
.stt-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1;
  padding: 8px 6px;
  min-width: 32px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}
.stt-btn:hover {
  background: #e8f1fa;
}
.stt-btn:active {
  transform: scale(1.08);
  background: #dceaf7;
}

.phieu-detail {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 95;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  background: rgba(15, 32, 51, 0.45);
  backdrop-filter: blur(4px);
}
.phieu-detail.show {
  display: flex;
  animation: phieuFade 0.18s ease;
}
@keyframes phieuFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.phieu-detail-card {
  width: min(520px, 100%);
  max-height: min(90dvh, 820px);
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  padding: 14px 14px 16px;
  box-shadow: 0 18px 48px rgba(15, 32, 51, 0.22);
  margin: auto;
  display: grid;
  gap: 12px;
  animation: phieuZoom 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes phieuZoom {
  from { transform: scale(0.96); opacity: 0.85; }
  to { transform: none; opacity: 1; }
}
.phieu-detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.phieu-detail-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}
.phieu-detail-stt {
  font-weight: 800;
  color: var(--accent);
  font-size: 0.86rem;
  letter-spacing: -0.02em;
}
.phieu-detail-close {
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.phieu-detail-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.18rem;
  line-height: 1.25;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.phieu-detail-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.phieu-detail-shot {
  appearance: none;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  aspect-ratio: 1;
  background: #f8fafc;
  cursor: zoom-in;
}
.phieu-detail-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.phieu-detail-noimg {
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px dashed #e2e8f0;
}
.phieu-journey-grid {
  margin: 0;
  padding: 10px;
  border: 1px solid #e8eef5;
  border-radius: 14px;
  background: #f8fafc;
}
.phieu-journey-grid .journey-timeline-title {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.phieu-journey-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.phieu-journey-step {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 6px;
  row-gap: 1px;
  align-items: start;
  margin: 0;
  padding: 8px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e8eef5;
  min-height: 58px;
}
.phieu-journey-step::before,
.phieu-journey-step .journey-dot {
  content: none !important;
  display: none !important;
}
.phieu-journey-step {
  position: static;
  padding-bottom: 8px;
}
.phieu-journey-n {
  grid-row: 1 / span 2;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 800;
  color: #64748b;
  background: #e2e8f0;
}
.phieu-journey-step strong {
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
  color: #334155;
}
.phieu-journey-step span:last-child {
  font-size: 0.64rem;
  color: #94a3b8;
  line-height: 1.25;
}
.phieu-journey-step.is-done {
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.phieu-journey-step.is-done .phieu-journey-n {
  background: #16a34a;
  color: #fff;
}
.phieu-journey-step.is-active {
  border-color: #93c5fd;
  background: #eff6ff;
}
.phieu-journey-step.is-active .phieu-journey-n {
  background: #2563eb;
  color: #fff;
}
.phieu-journey-step.is-active strong {
  color: #1d4ed8;
}
.phieu-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.phieu-detail-cell {
  min-width: 0;
  min-height: 64px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid #e8eef5;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
}
.phieu-detail-cell.full {
  grid-column: 1 / -1;
  min-height: 0;
}
.phieu-detail-cell span {
  display: block;
  font-size: 0.68rem;
  font-weight: 650;
  color: #64748b;
  letter-spacing: 0.01em;
}
.phieu-detail-cell b {
  display: block;
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.3;
  word-break: break-word;
}
.phieu-detail-cell.is-price b {
  color: var(--accent-2);
  font-size: 0.98rem;
  font-weight: 800;
}
.phieu-detail-foot {
  display: grid;
  gap: 8px;
  margin-top: 2px;
}
.phieu-detail-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.phieu-detail-actions .btn {
  width: 100%;
}
.phieu-detail-copy {
  width: 100%;
  margin: 0;
}

@media (min-width: 480px) {
  .phieu-journey-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .phieu-journey-step:last-child:nth-child(5) {
    grid-column: 2 / 3;
  }
}
@media (min-width: 720px) {
  .phieu-detail {
    align-items: center;
  }
  .phieu-detail-card {
    width: min(560px, 100%);
    border-radius: 20px;
    padding: 18px;
  }
  .phieu-detail-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .phieu-detail-cell.full {
    grid-column: 1 / -1;
  }
  .phieu-journey-steps {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .phieu-journey-step:last-child:nth-child(5) {
    grid-column: auto;
  }
}
.sheet td.customer {
  width: 11%;
  font-weight: 600;
}
.sheet td.phone {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.58rem;
  letter-spacing: 0;
  width: 10%;
  white-space: nowrap;
}
.sheet td.name {
  width: 11%;
  font-weight: 600;
}
.sheet td.status {
  color: var(--muted);
  width: 10%;
}
.sheet td.note {
  width: 12%;
  color: var(--ink);
  font-weight: 500;
}
.sheet td.money {
  font-weight: 700;
  color: var(--accent-2);
  width: 9%;
  white-space: nowrap;
}
.sheet td.tt {
  width: 7%;
  white-space: nowrap;
  padding-left: 2px;
  padding-right: 2px;
}
.tt-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.25;
}
.tt-tag.paid {
  background: #dff3e8;
  color: #0f7a4d;
}
.tt-tag.paid-cuoc {
  background: #e8f1fa;
  color: #0f4c81;
}
.tt-tag.paid-both {
  background: #ecfdf5;
  color: #047857;
}
.tt-tag.unpaid {
  background: #fff4e8;
  color: #c2410c;
}
.sheet td.code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.58rem;
  letter-spacing: 0.02em;
}
.sheet th.date,
.sheet td.date {
  color: var(--muted);
  width: 8%;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 0.58rem;
  padding-left: 2px;
  padding-right: 2px;
}
.sheet td.branch {
  color: var(--muted);
  width: 10%;
}
.sheet td.img {
  width: 36px;
  padding: 2px;
}
.sheet td.act {
  padding: 2px;
  width: 48px;
}
.sheet td.act .btn {
  width: auto !important;
  padding: 2px 6px;
  font-size: 0.58rem;
}
.sheet-thumb {
  position: relative;
  display: inline-flex;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
  background: #e8eef4;
  cursor: pointer;
}
.sheet-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sheet-thumb-n {
  position: absolute;
  right: 0;
  bottom: 0;
  min-width: 12px;
  height: 12px;
  padding: 0 2px;
  border-radius: 999px;
  background: rgba(15, 76, 129, 0.9);
  color: #fff;
  font-size: 0.5rem;
  font-weight: 700;
  line-height: 12px;
  text-align: center;
}
.sheet-muted {
  color: var(--muted);
}

@media (min-width: 720px) {
  .app { padding-top: 28px; }
}

.cash-subtabs,
.cash-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}
.stats.stats-cash {
  grid-template-columns: repeat(2, 1fr);
}
.stats.stats-cash .stat-link {
  text-align: left;
  cursor: pointer;
  border: 0;
  width: 100%;
}
.stats.stats-cash .value.cash-kpi-val {
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  word-break: break-word;
}
.pay-branch-card {
  text-align: left;
  width: min(480px, 100%);
}
.pay-branch-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.pay-branch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}
.pay-branch-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pay-branch-main strong {
  font-size: 0.95rem;
  color: #0f172a;
}
.pay-branch-meta {
  font-size: 0.75rem;
  color: #64748b;
}
.pay-branch-money {
  flex: 0 0 auto;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #c2410c;
  font-size: 0.95rem;
}
.cash-item-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin-top: 4px;
  font-size: 0.78rem;
  color: #64748b;
}
.cash-amt {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.cash-amt.is-thu,
.cash-report-hero.is-thu strong {
  color: var(--ok);
}
.cash-amt.is-chi,
.cash-report-hero.is-chi strong {
  color: var(--danger);
}
.cash-item.is-thu {
  border-color: color-mix(in srgb, var(--ok) 22%, #e5e7eb);
}
.cash-item.is-chi {
  border-color: color-mix(in srgb, var(--danger) 18%, #e5e7eb);
}
.cash-loai-pick {
  margin-bottom: 14px;
}
.cash-loai-btn.active[data-cash-loai="thu"] {
  background: #dff3e8;
  border-color: #0f7a4d;
  color: #0f7a4d;
}
.cash-loai-btn.active[data-cash-loai="chi"] {
  background: #fee2e2;
  border-color: #b42318;
  color: #b42318;
}
.cash-form-card .btn {
  margin-top: 4px;
}
.cash-report-hero {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  margin-bottom: 12px;
}
.cash-report-hero span {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
}
.cash-report-hero strong {
  display: block;
  font-family: var(--display);
  font-size: 1.7rem;
  letter-spacing: -0.03em;
  margin: 6px 0 4px;
}
.cash-report-hero p {
  margin: 0;
  font-size: 0.8rem;
  color: #64748b;
}
.cash-report-grid {
  display: grid;
  gap: 10px;
}
@media (min-width: 720px) {
  .stats.stats-cash {
    grid-template-columns: repeat(4, 1fr);
  }
  .cash-report-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.cash-report-grid article {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 12px 14px;
}
.cash-report-grid h4 {
  margin: 0 0 8px;
  font-size: 0.86rem;
}
.cash-report-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  padding: 7px 0;
  border-top: 1px solid #f1f5f9;
  font-size: 0.84rem;
}
.cash-report-row:first-of-type {
  border-top: 0;
}
.cash-report-row em {
  grid-column: 1 / -1;
  font-style: normal;
  font-size: 0.72rem;
  color: #94a3b8;
}
.cash-report-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.cash-report-foot div {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 12px;
}
.cash-report-foot span {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
}
.cash-report-foot b {
  display: block;
  margin-top: 4px;
  font-size: 1.02rem;
}

.cn-domain-note { margin: 6px 2px 10px; font-size: 13px; color: var(--muted, #64748b); }
.cn-domain-note a { color: #1d4ed8; font-weight: 600; text-decoration: none; }

/* ===== Responsive Desktop Sidebar + Mobile Drawer Shell ===== */
.app-menu-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 10px;
  border-bottom: 1px solid #eef2f7;
  text-decoration: none;
  color: var(--ink);
}
.app-menu-brand img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}
.app-menu-brand div {
  display: grid;
  gap: 1px;
  min-width: 0;
}
.app-menu-brand b {
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.15;
}
.app-menu-brand span {
  font-size: 0.72rem;
  color: #64748b;
}
.app-menu-head {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
}
.app-menu-link {
  border-radius: 10px;
  transition: background 0.14s ease, color 0.14s ease;
}
.app-menu-link.is-active {
  background: #eff6ff;
  color: #0f4c81;
  font-weight: 700;
  box-shadow: inset 3px 0 0 #0f4c81;
}

@media (max-width: 959px) {
  body[data-page]:not(.cn-display) .app {
    max-width: 100%;
    padding: 0 max(12px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  body[data-page]:not(.cn-display) .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    margin: 0 calc(max(12px, env(safe-area-inset-left)) * -1) 14px;
    padding: calc(10px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
    background: rgba(248, 250, 252, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(183, 199, 216, 0.55);
  }
}

@media (min-width: 960px) {
  body[data-page]:not([data-page="login"]):not(.cn-display) {
    background:
      radial-gradient(circle at 100% 0%, rgba(147, 197, 253, 0.22) 0%, transparent 40%),
      linear-gradient(180deg, #f8fafc 0%, #eff4fa 100%);
  }
  body[data-page]:not([data-page="login"]):not(.cn-display) .app {
    max-width: none !important;
    width: 100%;
    margin: 0;
    padding: 22px 28px 40px calc(248px + 28px);
  }
  body[data-page]:not([data-page="login"]):not(.cn-display) .topbar,
  body[data-page]:not([data-page="login"]):not(.cn-display) [id^="panel-"] {
    max-width: 1240px;
    margin-left: auto;
    margin-right: auto;
  }
  body[data-page]:not([data-page="login"]):not(.cn-display) .topbar {
    padding-bottom: 14px;
    margin-bottom: 20px;
    border-bottom: 1px solid #dbe4ee;
  }
  body[data-page]:not([data-page="login"]):not(.cn-display) .topbar-home {
    display: none;
  }
  body[data-page]:not([data-page="login"]):not(.cn-display) .topbar h2 {
    font-size: 1.48rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: #0f172a;
  }
  body[data-page]:not([data-page="login"]):not(.cn-display) .app-menu-btn,
  body[data-page]:not([data-page="login"]):not(.cn-display) .app-menu-backdrop {
    display: none !important;
  }
  body[data-page]:not([data-page="login"]):not(.cn-display) .app-menu-panel,
  body[data-page]:not([data-page="login"]):not(.cn-display) .app-menu-panel[hidden] {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    right: auto;
    width: 248px;
    height: 100dvh;
    z-index: 45;
    padding: 14px 12px 14px;
    gap: 8px;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    box-shadow: 2px 0 18px rgba(15, 23, 42, 0.04);
    animation: none;
  }
  body[data-page]:not([data-page="login"]):not(.cn-display) .app-menu-nav {
    gap: 2px;
  }
  body[data-page]:not([data-page="login"]):not(.cn-display) .app-menu-link {
    padding: 8px 10px;
    font-size: 0.88rem;
  }
  body[data-page]:not([data-page="login"]):not(.cn-display) .app-menu-link.is-active {
    box-shadow: none;
    background: #eff6ff;
    color: #0f4c81;
  }
  body[data-page]:not([data-page="login"]):not(.cn-display) .app-menu-pin,
  body[data-page]:not([data-page="login"]):not(.cn-display) .app-menu-logout {
    padding: 8px 10px;
    font-size: 0.86rem;
  }
  body[data-page]:not([data-page="login"]):not(.cn-display) .card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05), 0 8px 24px rgba(15, 76, 129, 0.04);
    backdrop-filter: none;
  }
}

