:root {
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-2: #eef2f4;
  --ink: #172026;
  --muted: #65727e;
  --line: #d9e1e7;
  --brand: #176b5b;
  --brand-strong: #0d4f43;
  --brand-soft: rgba(23, 107, 91, 0.14);
  --brand-strip: rgba(23, 107, 91, 0.1);
  --accent: #b94f23;
  --danger: #b3261e;
  --shadow: 0 16px 42px rgba(20, 34, 45, 0.09);
  --depth-shadow: 0 22px 52px rgba(20, 34, 45, 0.14), 0 4px 0 rgba(255, 255, 255, 0.7) inset;
  --deep-shadow: 0 28px 72px rgba(18, 31, 40, 0.2);
  --copyright-height: 1.5cm;
}

* {
  box-sizing: border-box;
}

html {
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  padding-bottom: 0;
  background:
    linear-gradient(135deg, rgba(23, 107, 91, 0.12), transparent 30%),
    linear-gradient(315deg, rgba(185, 79, 35, 0.1), transparent 32%),
    linear-gradient(180deg, #f8fafb, #edf2f5);
  overflow-x: hidden;
}

img,
canvas,
video {
  max-width: 100%;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(23, 107, 91, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 107, 91, 0.06) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 82%);
}

button,
input,
select,
textarea {
  font: inherit;
  line-height: 1.3;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 0;
  position: relative;
  transform-style: preserve-3d;
}

.app-shell::before {
  content: "";
  position: fixed;
  left: 50%;
  top: 62%;
  width: min(980px, 78vw);
  aspect-ratio: 1 / 1;
  background: url("assets/logo-song-anh.png?v=20260508-psd-logo") center / contain no-repeat;
  opacity: 0.30;
  filter: saturate(0.95) contrast(1.02);
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 0;
}


.app-shell > * {
  position: relative;
  z-index: 1;
}

.app-copyright {
  position: fixed !important;
  left: 0;
  right: 0;
  bottom: 0 !important;
  height: var(--copyright-height);
  min-height: var(--copyright-height);
  margin: 0;
  background: #2c7fbe;
  border-top: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 -8px 18px rgba(12, 40, 67, 0.22);
  z-index: 80;
}

.app-copyright-inner {
  height: 100%;
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 0;
}

.app-copyright-logo-wrap {
  height: 100%;
  min-width: 104px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid rgba(255, 255, 255, 0.4);
}

.app-copyright-logo-wrap img {
  display: block;
  max-height: calc(var(--copyright-height) - 5px);
  width: auto;
}

.app-copyright-text {
  color: #fff;
  text-align: center;
  line-height: 1.06;
  display: grid;
  gap: 2px;
}

.app-copyright-text strong {
  font-size: clamp(13px, 1.42vw, 45px);
  font-weight: 500;
}

.app-copyright-text span {
  font-size: clamp(11px, 1.25vw, 31px);
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(520px, 100%);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 8px;
  box-shadow: var(--deep-shadow);
  padding: 28px;
  backdrop-filter: blur(18px);
  transform: none;
}

.auth-panel::before {
  display: none;
}



h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 30px;
  letter-spacing: 0;
}

h2 {
  font-size: 22px;
  letter-spacing: 0;
}

h3 {
  font-size: 17px;
  letter-spacing: 0;
}

.muted {
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  display: block;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  outline: none;
  box-shadow: inset 0 1px 2px rgba(20, 34, 45, 0.06), 0 1px 0 rgba(255, 255, 255, 0.85);
  line-height: 1.35;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

textarea {
  resize: vertical;
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button {
  min-height: 40px;
  border-radius: 6px;
  padding: 9px 13px;
  font-weight: 650;
  white-space: nowrap;
  transform: translateY(0);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
  box-shadow: 0 8px 18px rgba(20, 34, 45, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.ghost-button:hover {
  transform: translateY(-1px) translateZ(6px);
  box-shadow: 0 14px 28px rgba(20, 34, 45, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.primary-button:active,
.secondary-button:active,
.danger-button:active,
.ghost-button:active,
.compact-button:active,
.nav-button:active {
  transform: translateY(1px) translateZ(0);
  box-shadow: 0 4px 10px rgba(20, 34, 45, 0.12);
}

.primary-button {
  color: #fff;
  background: var(--brand);
}

.primary-button:hover {
  background: var(--brand-strong);
}

.secondary-button {
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.danger-button {
  color: #fff;
  background: var(--danger);
}

.ghost-button {
  color: var(--ink);
  background: var(--surface-2);
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
}

.login-qr-modal {
  width: min(420px, 100%);
}

.login-qr-preview {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 6px 0 10px;
  text-align: center;
}

.login-qr-preview img {
  width: min(240px, 100%);
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.login-qr-preview p {
  margin: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: rgba(255, 255, 255, 0.70);
  border-bottom: 1px solid rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 30px rgba(20, 34, 45, 0.08);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand-block strong {
  font-size: 18px;
}

.brand-logo-mark {
  display: none;
}


.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.brand-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.subscription-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 850;
  color: #fff;
  box-shadow: 0 8px 18px rgba(20, 34, 45, 0.14);
}

.subscription-ok {
  background: #047857;
}

.subscription-warning {
  color: #3b2500;
  background: #facc15;
  animation: pulseWarning 1.4s ease-in-out infinite;
}

.subscription-danger,
.subscription-expired {
  background: #b3261e;
  animation: pulseDanger 0.9s ease-in-out infinite;
}

.subscription-admin {
  background: var(--brand);
}

@keyframes pulseWarning {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes pulseDanger {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(179, 38, 30, 0); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(179, 38, 30, 0.16); }
}

.scanner-strip {
  display: grid;
  grid-template-columns: minmax(220px, 420px) minmax(0, auto);
  gap: 10px;
  align-items: end;
  padding: 14px 22px;
  background:
    linear-gradient(135deg, var(--brand-strip), rgba(255, 255, 255, 0.72));
  border-bottom: 1px solid rgba(255, 255, 255, 0.74);
  box-shadow: 0 14px 30px rgba(20, 34, 45, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.scanner-strip label {
  color: var(--brand-strong);
}

.scanner-strip input {
  border-color: var(--brand);
  box-shadow: 0 12px 28px var(--brand-soft), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.scanner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: calc(100vh - 134px);
  perspective: 1400px;
}

.sidebar {
  padding: 18px 14px;
  background:
    linear-gradient(180deg, rgba(30, 43, 50, 0.98), rgba(42, 56, 65, 0.98)),
    linear-gradient(135deg, var(--brand-soft), transparent 52%);
  color: #fff;
  box-shadow: 18px 0 42px rgba(20, 34, 45, 0.18), inset -1px 0 0 rgba(255, 255, 255, 0.08);
  transform: translateZ(10px);
}

.nav-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin-bottom: 7px;
  border-radius: 6px;
  padding: 10px 12px;
  color: #dce5e9;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: translateX(0) translateZ(0);
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.nav-button:hover {
  color: #fff;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05)),
    linear-gradient(90deg, var(--brand-soft), transparent);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18), inset 3px 0 0 var(--brand), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transform: translateX(4px) translateZ(8px);
}

.nav-button.active {
  color: #fff;
  background:
    linear-gradient(145deg, var(--brand), var(--brand-strong));
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 34px var(--brand-soft), 0 10px 24px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transform: translateX(4px) translateZ(12px);
}

.content {
  padding: 22px;
  padding-bottom: calc(14px + var(--copyright-height));
  min-width: 0;
  transform-style: preserve-3d;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.grid-2,
.grid-3,
.stats-grid {
  display: grid;
  gap: 14px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.panel,
.stat,
.receipt,
.qr-panel {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  box-shadow: var(--depth-shadow);
  backdrop-filter: blur(14px);
  transform: none;
  transform-style: flat;
  transition: box-shadow 180ms ease, border-color 180ms ease;
}

.panel:hover,
.stat:hover,
.receipt:hover,
.qr-panel:hover {
  border-color: rgba(255, 255, 255, 0.96);
  box-shadow: 0 30px 70px rgba(20, 34, 45, 0.17), 0 4px 0 rgba(255, 255, 255, 0.75) inset;
}

.panel {
  padding: 16px;
}

.stat {
  padding: 15px;
  position: relative;
  overflow: hidden;
}

.stat::after {
  content: "";
  position: absolute;
  inset: auto 12px 12px auto;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--stat-glow, var(--brand-soft));
  filter: blur(18px);
  opacity: 0.72;
  pointer-events: none;
}

.stat span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.stat strong {
  font-size: 22px;
  text-shadow: 0 1px 0 #fff;
  position: relative;
  z-index: 1;
}

.stat-revenue {
  --stat-glow: rgba(22, 163, 74, 0.18);
}

.stat-revenue strong,
.metric-revenue {
  color: #047857;
}

.stat-profit {
  --stat-glow: rgba(185, 79, 35, 0.2);
}

.stat-profit strong,
.metric-profit {
  color: var(--accent);
}

.metric-alert {
  color: var(--danger);
}

.stat-cost {
  --stat-glow: rgba(37, 99, 235, 0.16);
}

.stat-cost strong,
.metric-cost {
  color: #1d4ed8;
}

.stat-stock {
  --stat-glow: var(--brand-soft);
}

.stat-stock strong,
.metric-stock {
  color: var(--brand-strong);
}

.stat-count {
  --stat-glow: rgba(124, 58, 237, 0.16);
}

.stat-count strong {
  color: #6d28d9;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 14px;
}

.toolbar label {
  min-width: 180px;
}

.toolbar > button {
  min-height: 42px;
  align-self: flex-end;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 16px 38px rgba(20, 34, 45, 0.08);
}

.table-note {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--brand-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 700;
}

.inventory-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pagination-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.report-section {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  position: relative;
  isolation: isolate;
}

.report-section::before {
  content: "";
  position: absolute;
  inset: 4% 8%;
  background: url("assets/logo-song-anh.png?v=20260508-psd-logo") center / min(560px, 72%) no-repeat;
  opacity: 0.30;
  pointer-events: none;
  z-index: -1;
}

.report-section > * {
  position: relative;
  z-index: 1;
}

.report-section:first-child {
  margin-top: 0;
}

.report-section h2,
.report-section h3 {
  margin-bottom: 0;
}

.restock-summary {
  margin-top: 14px;
}

.summary-panel {
  min-height: 150px;
}

.summary-list {
  display: grid;
  gap: 8px;
}

.summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.summary-item strong {
  overflow-wrap: anywhere;
}

.summary-item span {
  white-space: nowrap;
  font-weight: 760;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
  background: rgba(245, 247, 249, 0.82);
}

td.number,
th.number {
  text-align: right;
}

.sort-header {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  color: inherit;
  background: transparent;
  text-align: inherit;
  text-transform: inherit;
  font: inherit;
  font-weight: inherit;
  padding: 0;
}

.sort-header:hover,
.sort-header.active {
  color: var(--brand-strong);
}

th.number .sort-header {
  justify-content: flex-end;
}

td.number[class*="metric-"] {
  font-weight: 760;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  transition: background 140ms ease, transform 140ms ease;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.72);
  transform: translateZ(4px);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.form-grid .row-actions {
  margin-top: 2px;
}

.sale-history-panel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(20, 34, 45, 0.08);
}

.sale-controls-mobile-target {
  margin-bottom: 12px;
}

.selected-sale-row {
  background: rgba(23, 107, 91, 0.08);
}

.active-filter-button {
  color: #fff;
  background: var(--brand);
}

.report-mode-note {
  padding: 10px 12px;
  border: 1px solid rgba(23, 107, 91, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

#report-print-root {
  display: grid;
  gap: 18px;
  margin-top: 16px;
}

.compact-button {
  min-height: 32px;
  border-radius: 6px;
  padding: 6px 9px;
  color: var(--ink);
  background: var(--surface-2);
  box-shadow: 0 6px 14px rgba(20, 34, 45, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.75);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.compact-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(20, 34, 45, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.compact-button.danger {
  color: #fff;
  background: var(--danger);
}

.sale-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 16px;
}

.cart-total {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.cart-total-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.receipt-payment-methods {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.receipt-payment-option {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
}

.receipt-payment-option input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.receipt-payment-option input:disabled + span {
  opacity: 0.78;
}

.cart-total-summary {
  text-align: right;
}

.cart-total strong {
  font-size: 28px;
  color: var(--accent);
  text-shadow: 0 1px 0 #fff;
}

.cart-qty-control {
  display: grid;
  gap: 5px;
  min-width: 120px;
}

.cart-qty-control select {
  min-height: 38px;
  text-align: right;
}

.stock-note,
.stock-warning {
  font-size: 12px;
  font-weight: 700;
}

.stock-note {
  color: var(--muted);
}

.stock-warning {
  color: var(--danger);
}

.stock-warning-box {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(179, 38, 30, 0.28);
  border-radius: 8px;
  background: rgba(179, 38, 30, 0.09);
  color: var(--danger);
  font-weight: 760;
}

.stock-short-row {
  background: rgba(179, 38, 30, 0.06);
}

.receipt {
  padding: 16px;
}

.receipt-store-name {
  margin-top: -4px;
  margin-bottom: 5px;
  font-size: 16px;
  font-weight: 800;
}

.receipt-store-info {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.receipt-store-info p {
  margin: 2px 0;
}

.receipt-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.receipt-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: baseline;
}

.receipt-item span:first-child {
  overflow-wrap: anywhere;
}

.qr-panel {
  display: grid;
  place-items: center;
  min-height: 280px;
  padding: 16px;
  text-align: center;
}

.qr-panel img {
  width: min(240px, 100%);
  height: auto;
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(20, 34, 45, 0.13);
}

.thermal-print-button {
  width: 100%;
  margin-top: 12px;
}

.thermal-print-area {
  display: none;
}

.empty-state {
  padding: 26px;
  color: var(--muted);
  text-align: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--brand-strong);
  background: var(--brand-soft);
  font-size: 12px;
  font-weight: 700;
}

.pill.expired {
  color: var(--danger);
  background: rgba(179, 38, 30, 0.12);
}

.pill.stock-available {
  color: #0b6b3a;
  background: rgba(22, 163, 74, 0.16);
}

.pill.stock-missing {
  color: #9a3412;
  background: rgba(249, 115, 22, 0.16);
}

input[readonly] {
  color: var(--muted);
  background: var(--surface-2);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(12, 18, 22, 0.46);
}

.settings-modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--deep-shadow);
  padding: 18px;
  backdrop-filter: blur(18px);
  transform: none;
}

.camera-modal {
  width: min(720px, 100%);
  max-height: calc(100vh - 28px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--deep-shadow);
  padding: 16px;
}

.camera-frame {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: #0b1115;
  aspect-ratio: 4 / 3;
}

.camera-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scan-box {
  position: absolute;
  inset: 22% 12%;
  border: 3px solid var(--brand);
  border-radius: 8px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.28), 0 0 24px var(--brand-soft);
  pointer-events: none;
}

.scan-box::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  border-top: 2px solid rgba(255, 255, 255, 0.88);
}

.camera-alternatives {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.camera-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.theme-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.theme-picker input[type="color"] {
  width: 54px;
  min-height: 42px;
  padding: 4px;
}

.theme-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-swatch {
  width: 34px;
  height: 34px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.theme-swatch.active {
  border-color: var(--ink);
}

.danger-text {
  color: var(--danger);
}

.success-text {
  color: var(--brand-strong);
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .layout,
  .sale-layout,
  .grid-2,
  .grid-3,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px 14px;
    transform: none;
  }

  .nav-button {
    min-width: 145px;
    margin-bottom: 0;
  }

  .topbar,
  .scanner-strip,
  .content {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }

  .toolbar label {
    flex: 1 1 220px;
  }
}

@media (max-width: 768px) {
  .sale-history-panel {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .panel,
  .stat,
  .receipt,
  .qr-panel,
  .auth-panel,
  .settings-modal,
  .sidebar {
    transform: none !important;
  }
}

@media (max-width: 640px) {
  body {
    background:
      linear-gradient(180deg, rgba(23, 107, 91, 0.08), transparent 260px),
      #f5f7f9;
  }

  body::before,
  .app-shell::before {
    opacity: 0.12;
  }

  .topbar,
  .scanner-strip,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    gap: 12px;
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .brand-block {
    align-items: flex-start;
  }

  .brand-block strong {
    font-size: 16px;
  }

  .app-copyright-logo-wrap {
    min-width: 74px;
  }

  .app-copyright-inner {
    gap: 6px;
    padding-right: 8px;
  }

  .app-copyright-text strong {
    font-size: 12px;
  }

  .app-copyright-text span {
    font-size: 11px;
  }

  .brand-status {
    gap: 6px;
  }

  .topbar-actions,
  .row-actions,
  .pagination-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .topbar-actions button,
  .row-actions button,
  .pagination-actions button,
  .toolbar button,
  .primary-button,
  .secondary-button,
  .danger-button,
  .ghost-button {
    width: 100%;
    white-space: normal;
  }

  .scanner-strip {
    display: flex;
    gap: 12px;
  }

  .scanner-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .scanner-actions button {
    width: 100%;
  }

  .layout {
    min-height: auto;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 9;
    padding: 10px max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
    box-shadow: 0 10px 26px rgba(20, 34, 45, 0.18);
  }

  .nav-button {
    min-width: 132px;
    min-height: 38px;
    padding: 8px 10px;
    font-size: 13px;
  }

  h1 {
    font-size: 23px;
  }

  h2 {
    font-size: 19px;
  }

  h3 {
    font-size: 16px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
  }

  .panel,
  .stat,
  .receipt,
  .qr-panel {
    transform: none;
    box-shadow: 0 12px 28px rgba(20, 34, 45, 0.09);
  }

  .panel,
  .receipt,
  .qr-panel {
    padding: 13px;
  }

  .stats-grid {
    gap: 10px;
  }

  .stat {
    padding: 12px;
  }

  .stat strong {
    font-size: 19px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .toolbar label {
    min-width: 0;
  }

  .cart-total-head {
    align-items: stretch;
    flex-direction: column;
  }

  .receipt-payment-methods {
    gap: 12px;
  }

  .cart-total-summary {
    text-align: left;
  }

  table {
    min-width: 720px;
  }

  th,
  td {
    padding: 9px 10px;
  }

  .sale-layout {
    gap: 12px;
  }

  #cart-slot .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  #cart-slot table,
  #cart-slot tbody,
  #cart-slot tr,
  #cart-slot td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  #cart-slot table {
    border-collapse: separate;
  }

  #cart-slot thead {
    display: none;
  }

  #cart-slot tr {
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.78);
  }

  #cart-slot td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid rgba(217, 225, 231, 0.72);
    text-align: right;
  }

  #cart-slot td:last-child {
    border-bottom: 0;
  }

  #cart-slot td::before {
    content: attr(data-label);
    flex: 0 0 38%;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
    text-align: left;
    text-transform: uppercase;
  }

  #cart-slot td[data-label="Tên mặt hàng"] {
    display: block;
    text-align: left;
    font-weight: 760;
  }

  #cart-slot td[data-label="Tên mặt hàng"]::before {
    display: block;
    margin-bottom: 4px;
  }

  .cart-qty-control {
    justify-items: end;
    min-width: 130px;
  }

  .cart-total {
    text-align: left;
  }

  .cart-total strong {
    font-size: 24px;
  }

  .receipt-line,
  .receipt-item {
    gap: 8px;
  }

  .receipt-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .receipt-item strong {
    grid-column: 1 / -1;
    text-align: right;
  }

  .camera-modal {
    width: 100%;
    padding: 12px;
  }

  .camera-frame {
    aspect-ratio: 3 / 4;
  }

  .camera-alternatives,
  .camera-alternatives label {
    width: 100%;
  }

  .content {
    padding: 14px;
    padding-bottom: calc(10px + var(--copyright-height));
  }

  .auth-panel {
    padding: 20px;
  }

  .settings-modal {
    width: 100%;
    padding: 14px;
  }
}

@media (max-width: 420px) {
  .topbar,
  .scanner-strip,
  .content {
    padding-left: 10px;
    padding-right: 10px;
  }

  .content {
    padding-bottom: calc(8px + var(--copyright-height));
  }

  .sidebar {
    padding-left: 10px;
    padding-right: 10px;
  }

  .nav-button {
    min-width: 118px;
    font-size: 12px;
  }

  .subscription-badge,
  .pill {
    max-width: 100%;
  }

  .panel,
  .receipt,
  .qr-panel {
    padding: 11px;
  }

  .app-copyright-logo-wrap {
    min-width: 68px;
  }

  .app-copyright-text strong {
    font-size: 11px;
  }

  .app-copyright-text span {
    font-size: 10px;
  }
}

@page {
  size: A4 landscape;
  margin: 10mm;
}

@page thermal {
  size: 80mm 297mm;
  margin: 3mm;
}

@media print {
  * {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
    box-shadow: none !important;
    text-shadow: none !important;
    transform: none !important;
  }

  body {
    color: #111827;
    background: #fff !important;
    padding-bottom: 0 !important;
  }

  body::before,
  .app-shell::before,
  .auth-panel::before,
  .app-copyright,
  .topbar,
  .scanner-strip,
  .sidebar,
  .modal-backdrop,
  button {
    display: none !important;
  }

  .layout,
  .content,
  .view.active {
    display: block !important;
    width: 100% !important;
    min-height: 0 !important;
    padding: 0 !important;
  }

  .content::before {
    content: attr(data-print-title);
    display: block;
    margin-bottom: 8mm;
    padding-bottom: 4mm;
    border-bottom: 1px solid #d1d5db;
    color: #111827;
    font-size: 18pt;
    font-weight: 800;
  }

  body.printing-report .content::after {
    content: "";
    position: fixed;
    left: 50%;
    top: 56%;
    width: 150mm;
    height: 150mm;
    background: url("assets/logo-song-anh.png?v=20260508-psd-logo") center / contain no-repeat;
    opacity: 0.30;
    transform: translate(-50%, -50%) !important;
    pointer-events: none;
    z-index: -1;
  }

  body.printing-report-reports-only #view-reports > :not(#report-print-root) {
    display: none !important;
  }

  body.printing-report-reports-only #report-print-root {
    margin-top: 0 !important;
  }

  .view:not(.active) {
    display: none !important;
  }

  .panel,
  .stat,
  .receipt,
  .qr-panel,
  .table-wrap {
    border: 1px solid #d1d5db !important;
    background: #fff !important;
    break-inside: avoid;
    backdrop-filter: none !important;
  }

  .panel,
  .receipt,
  .qr-panel {
    padding: 8px !important;
  }

  .section-head,
  .toolbar,
  .grid-2,
  .grid-3,
  .stats-grid,
  .sale-layout {
    gap: 8px !important;
  }

  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  h1 {
    font-size: 18pt;
  }

  h2 {
    font-size: 14pt;
  }

  h3 {
    font-size: 11pt;
  }

  p,
  label,
  .muted,
  .pill {
    font-size: 9pt;
  }

  .stat {
    padding: 8px !important;
  }

  .stat::after {
    display: none !important;
  }

  .stat strong,
  .cart-total strong {
    font-size: 14pt;
  }

  table {
    min-width: 0 !important;
    font-size: 8.5pt;
  }

  th,
  td {
    padding: 4px 5px !important;
  }

  input,
  select,
  textarea {
    min-height: 26px !important;
    border: 1px solid #d1d5db !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  .table-wrap {
    overflow: visible !important;
  }

  .report-section {
    break-inside: avoid;
    margin-top: 0 !important;
  }

  body.thermal-printing {
    width: 80mm !important;
    min-width: 0 !important;
    margin: 0 !important;
    background: #fff !important;
  }

  body.thermal-printing .app-shell::before,
  body.thermal-printing .auth-panel::before {
    display: none !important;
  }

  body.thermal-printing * {
    visibility: hidden !important;
  }

  body.thermal-printing .content::before {
    display: none !important;
  }

  body.thermal-printing .layout,
  body.thermal-printing .content,
  body.thermal-printing .view.active,
  body.thermal-printing .sale-layout,
  body.thermal-printing aside,
  body.thermal-printing #receipt-slot {
    display: block !important;
    width: 80mm !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.thermal-printing .thermal-print-area,
  body.thermal-printing .thermal-print-area * {
    visibility: visible !important;
  }

  body.thermal-printing .thermal-print-area {
    page: thermal;
    display: block !important;
    position: absolute;
    inset: 0 auto auto 0;
    width: 74mm !important;
    padding: 0 !important;
    border: 0 !important;
    background: #fff !important;
    color: #000 !important;
    font-family: Arial, "Helvetica Neue", sans-serif;
    font-size: 9pt;
    line-height: 1.28;
  }

  .thermal-store,
  .thermal-title,
  .thermal-footer,
  .thermal-qr {
    text-align: center;
  }

  .thermal-store {
    font-size: 12pt;
    font-weight: 800;
    text-transform: uppercase;
  }

  .thermal-title {
    margin-top: 2mm;
    font-size: 10pt;
    font-weight: 800;
  }

  .thermal-contact {
    text-align: center;
    font-size: 7.8pt;
    overflow-wrap: anywhere;
  }

  .thermal-meta,
  .thermal-item-line,
  .thermal-total {
    display: flex;
    justify-content: space-between;
    gap: 3mm;
  }

  .thermal-meta {
    margin-top: 1.2mm;
    font-size: 8.2pt;
  }

  .thermal-meta strong,
  .thermal-item-line strong,
  .thermal-total strong {
    text-align: right;
  }

  .thermal-separator {
    margin: 2mm 0;
    border-top: 1px dashed #000;
  }

  .thermal-item {
    margin-bottom: 1.5mm;
    break-inside: avoid;
  }

  .thermal-item > div:first-child {
    font-weight: 700;
    overflow-wrap: anywhere;
  }

  .thermal-total {
    align-items: baseline;
    font-size: 11pt;
    font-weight: 800;
  }

  .thermal-total strong {
    font-size: 13pt;
  }

  .thermal-qr {
    margin-top: 3mm;
    font-size: 7.5pt;
  }

  .thermal-qr img {
    width: 42mm !important;
    height: auto !important;
    margin: 0 auto 1.5mm;
    border-radius: 0 !important;
  }

  .thermal-footer {
    margin-top: 3mm;
    font-weight: 700;
  }
}
