:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --ink: #161a1d;
  --muted: #66717f;
  --line: #dfe5ea;
  --line-strong: #c8d2dc;
  --accent: #010783;
  --accent-dark: #00055f;
  --accent-soft: #eef0ff;
  --danger: #a4163a;
  --danger-soft: #fde8ee;
  --warn: #a15c09;
  --warn-soft: #fff4df;
  --good: #176f45;
  --good-soft: #e8f7ef;
  --shadow: 0 10px 28px rgba(21, 32, 43, 0.08);
  --sidebar-width: 244px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
.button-link {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

button:hover,
.button-link:hover {
  background: var(--accent-dark);
}

button:active,
.button-link:active {
  transform: translateY(1px);
}

button.ghost,
.ghost-link {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

button.ghost:hover,
.ghost-link:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

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

button.danger:hover {
  background: #82112e;
}

button.icon-btn {
  background: var(--surface);
  border-color: var(--line);
  color: var(--accent-dark);
}

button.icon-btn:hover {
  background: var(--accent-soft);
  border-color: #b8dde2;
}

.topbar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 5;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  padding: 20px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  box-shadow: 8px 0 28px rgba(24, 33, 42, 0.04);
}

.brand {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  text-decoration: none;
  overflow: hidden;
}

.brand-logo {
  display: block;
  width: 190px;
  max-width: 92%;
  height: auto;
  object-fit: contain;
}

.login-logo {
  width: 226px;
  max-width: 100%;
  margin: 0 auto;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.sidebar-main {
  flex: 1;
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 10px;
}

.sidebar-label {
  margin: 10px 4px 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav a,
.app-switcher a,
.logout-link {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #29313a;
  text-decoration: none;
  border-radius: 6px;
  padding: 10px 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.app-switcher {
  display: grid;
  gap: 8px;
}

.app-switcher a {
  min-height: 54px;
  justify-content: flex-start;
  background: var(--surface-soft);
  border-color: var(--line);
}

.app-switcher a::before {
  width: 28px;
  height: 28px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #ffffff;
  color: var(--accent-dark);
  content: "B";
  font-size: 13px;
  font-weight: 900;
  border: 1px solid var(--line);
}

.app-switcher a[data-page="catalog"]::before {
  color: var(--good);
  content: "P";
}

.app-switcher a.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-color: #c7e7eb;
}

.catalog-shell .app-switcher a.active {
  background: var(--good-soft);
  color: var(--good);
  border-color: #b7dbc8;
}

.logout-link {
  margin-top: auto;
}

.nav a[data-page],
.app-switcher a[data-page] {
  display: none;
}

body.nav-ready .nav a[data-page],
body.nav-ready .app-switcher a[data-page] {
  display: flex;
}

body.nav-ready .nav a[data-page][hidden],
body.nav-ready .app-switcher a[data-page][hidden] {
  display: none;
}

.nav a.active,
.logout-link.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-color: #c7e7eb;
}

.nav a:hover,
.app-switcher a:hover,
.logout-link:hover {
  background: var(--surface-soft);
  border-color: var(--line);
}

.nav-badge {
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--danger);
  color: #ffffff;
  padding: 0 7px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.layout {
  width: min(1340px, calc(100vw - var(--sidebar-width) - 40px));
  margin: 24px 20px 24px calc(var(--sidebar-width) + 20px);
  display: grid;
  gap: 18px;
  align-items: start;
}

.two-col {
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.75fr);
}

.reception-layout,
.admin-layout,
.bills-layout {
  grid-template-columns: minmax(360px, 0.72fr) minmax(0, 1.28fr);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.sticky {
  position: sticky;
  top: 24px;
  align-self: start;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

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

h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.25;
  font-weight: 800;
}

.panel-head h1 {
  white-space: nowrap;
}

.panel-head .icon-btn {
  padding-inline: 12px;
}

.scan-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 12px;
}

.scan-result {
  border: 1px solid #b9dde2;
  border-radius: 8px;
  background: var(--accent-soft);
  padding: 14px;
  margin-bottom: 14px;
}

.scan-result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px auto;
  gap: 10px;
  align-items: end;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

label {
  color: #4e5965;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 127, 140, 0.14);
}

textarea {
  resize: vertical;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.product-card {
  min-height: 172px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
  display: grid;
  gap: 9px;
  align-content: start;
  box-shadow: 0 2px 8px rgba(22, 31, 39, 0.04);
}

.product-card:hover {
  border-color: #b9dce1;
  box-shadow: 0 8px 18px rgba(22, 31, 39, 0.08);
}

.product-card img.product-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.product-name {
  font-weight: 800;
  line-height: 1.25;
}

.price {
  color: var(--accent-dark);
  font-weight: 900;
}

.stock {
  font-size: 12px;
  color: var(--muted);
}

.variant-badge {
  display: inline-flex;
  width: fit-content;
  min-height: 24px;
  align-items: center;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
}

.cart-list {
  display: grid;
  gap: 10px;
  min-height: 84px;
}

.cart-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.qty-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.qty-input {
  width: 78px;
  min-height: 34px;
  padding: 6px 8px;
  text-align: center;
  font-weight: 800;
  background: #ffffff;
}

.qty-row button {
  width: 34px;
  min-height: 34px;
  padding: 0;
  background: #ffffff;
  border-color: var(--line-strong);
  color: var(--accent-dark);
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 2px solid var(--line);
  margin: 16px 0;
  padding-top: 14px;
  font-size: 20px;
}

.customer-form {
  display: grid;
}

.wide {
  width: 100%;
}

.empty-state {
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 18px;
  text-align: center;
  background: var(--surface-soft);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  z-index: 30;
  max-width: min(520px, calc(100vw - 32px));
  background: #18212a;
  color: #ffffff;
  border-radius: 6px;
  padding: 11px 16px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.hidden,
.hidden-file {
  display: none !important;
}

.apps-layout {
  display: block;
  max-width: 980px;
}

.app-launcher {
  min-height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 18px;
  align-content: center;
}

.app-card {
  min-height: 230px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 26px;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.app-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 14px 32px rgba(21, 32, 43, 0.12);
}

.app-card strong {
  font-size: 28px;
  line-height: 1.15;
}

.app-card span:last-child {
  color: var(--muted);
  font-weight: 700;
}

.app-mark {
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-size: 24px;
  font-weight: 900;
}

.product-mark {
  background: var(--good);
}

.catalog-layout {
  grid-template-columns: minmax(320px, 0.62fr) minmax(0, 1.38fr);
}

.catalog-form {
  display: grid;
  gap: 2px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.catalog-list {
  display: grid;
  gap: 10px;
}

.catalog-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px;
}

.catalog-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.catalog-open {
  min-height: 74px;
  justify-content: start;
  display: grid;
  gap: 4px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 6px 8px;
  text-align: left;
}

.catalog-open:hover {
  background: transparent;
}

.catalog-open strong {
  line-height: 1.25;
}

.catalog-open span,
.catalog-open small {
  color: var(--muted);
  font-weight: 700;
}

.catalog-delete {
  align-self: center;
}

.catalog-view-panel {
  min-height: calc(100vh - 48px);
}

.catalog-viewer {
  min-height: calc(100vh - 150px);
}

.catalog-frame-wrap {
  width: 100%;
  height: calc(100vh - 150px);
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.catalog-frame-wrap:fullscreen {
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
}

.catalog-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(14, 22, 29, 0.62);
}

.modal-card {
  width: min(620px, calc(100vw - 24px));
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 16px;
  box-shadow: var(--shadow);
}

.qr-reader {
  width: 100%;
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.file-reader {
  display: none;
}

.scanner-actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.variant-summary {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

.variant-photo {
  width: 92px;
  height: 92px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  background: #ffffff;
}

.variant-list {
  display: grid;
  gap: 9px;
  max-height: min(360px, 48vh);
  overflow: auto;
  padding-right: 2px;
}

.variant-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 11px;
  cursor: pointer;
}

.variant-option:hover {
  border-color: #b8dce0;
  background: var(--surface-soft);
}

.variant-option input {
  width: 18px;
  min-height: 18px;
}

.variant-option span {
  display: grid;
  gap: 3px;
}

.variant-option em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.variant-footer {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  align-items: end;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top left, #e9f7f8, transparent 34%), var(--bg);
}

.login-wrap {
  width: min(430px, calc(100vw - 28px));
}

.login-panel {
  display: grid;
  gap: 14px;
  padding: 24px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.summary-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.summary-box strong {
  display: block;
  font-size: 22px;
  margin-top: 4px;
}

.order-list {
  display: grid;
  gap: 10px;
}

.order-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  display: grid;
  gap: 7px;
  background: var(--surface);
}

.order-card:hover {
  border-color: #b8dce0;
}

.order-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.order-meta,
.item-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.bill-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.bill-table th,
.bill-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
}

.bill-table th {
  background: var(--surface-soft);
  color: #4e5965;
  font-size: 12px;
  text-transform: uppercase;
}

.bill-table th:last-child,
.bill-table td:last-child {
  text-align: right;
}

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

.payment-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.order-edit-qty {
  justify-content: flex-start;
}

.remove-cart-item {
  min-height: 30px;
  margin-top: 6px;
  padding: 5px 8px;
  font-size: 12px;
}

.cart-edit-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 10px 0 14px;
}

.discount-box {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
  margin: 14px 0;
}

.discount-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.bill-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 10px;
  margin-bottom: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-paid {
  background: var(--good-soft);
  color: var(--good);
}

.status-pending {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-cancelled {
  background: var(--danger-soft);
  color: var(--danger);
}

.bill-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.approval-list {
  display: grid;
  gap: 12px;
}

.approval-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.approval-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.8fr);
  gap: 14px;
  align-items: start;
}

.approval-values {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.approval-values > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.approval-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.user-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(180px, 0.85fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.user-form .field {
  margin-bottom: 0;
}

.user-list {
  display: grid;
  gap: 10px;
}

.user-card {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(190px, 0.85fr) minmax(150px, 0.75fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.admin-products {
  display: grid;
  gap: 12px;
}

.admin-product-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.admin-product-main {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}

.admin-product-media {
  width: 96px;
  height: 96px;
}

.admin-product-photo,
.admin-product-placeholder {
  width: 96px;
  height: 96px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.admin-product-photo {
  object-fit: cover;
}

.admin-product-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.admin-variant-list {
  display: grid;
}

.admin-variant-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 120px auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.admin-variant-row:last-child {
  border-bottom: 0;
}

.admin-product {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.admin-product:hover {
  border-color: #b8dce0;
}

.qr-img,
.qr-label-img {
  width: 84px;
  height: 84px;
  object-fit: contain;
}

.qr-label-img {
  height: 102px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.image-preview {
  min-height: 120px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.image-preview img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 6px;
}

.variant-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 14px;
  overflow: hidden;
}

.variant-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}

.variant-editor-head h2 {
  margin: 0;
  font-size: 16px;
}

.variant-rows {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.variant-edit-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.variant-row-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.variant-row-head strong {
  font-size: 14px;
}

.variant-row-head .remove-variant {
  min-height: 34px;
  padding: 6px 10px;
}

.variant-field {
  display: grid;
  gap: 5px;
}

.variant-sku-field {
  grid-column: 1 / -1;
}

.variant-edit-row input {
  min-height: 38px;
}

.label-sheet {
  display: none;
}

.receipt-wrap {
  width: min(900px, calc(100vw - 28px));
  margin: 24px auto;
}

.receipt {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.receipt-title {
  text-align: center;
  margin-bottom: 14px;
}

.receipt h1 {
  text-align: center;
  font-size: 21px;
  margin-bottom: 8px;
}

.receipt h2 {
  margin: 4px 0 0;
  font-size: 18px;
}

.receipt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
}

.receipt-totals {
  width: min(320px, 100%);
  margin-left: auto;
}

.receipt-footer {
  text-align: center;
  margin-top: 28px;
}

.a4-receipt {
  min-height: 297mm;
  padding: 18mm;
}

.challan-print .receipt-wrap {
  width: min(86mm, calc(100vw - 20px));
}

.challan-receipt {
  padding: 10px;
  font-size: 12px;
}

.challan-receipt h1 {
  font-size: 18px;
}

.challan-receipt h2 {
  font-size: 14px;
}

.challan-receipt .bill-table th,
.challan-receipt .bill-table td {
  padding: 6px 4px;
}

.challan-table th:last-child,
.challan-table td:last-child {
  width: 44px;
}

.signature-line {
  margin-top: 28px;
  border-top: 1px solid var(--ink);
  padding-top: 6px;
  text-align: right;
}

.print-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

@media (max-width: 860px) {
  .topbar {
    position: sticky;
    width: auto;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }

  .brand {
    min-width: 128px;
    min-height: 54px;
    padding: 6px;
  }

  .brand-logo {
    width: 120px;
  }

  .sidebar-main {
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
  }

  .sidebar-label {
    display: none;
  }

  .app-switcher {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
  }

  .nav {
    flex-direction: row;
    flex-wrap: nowrap;
  }

  .nav a,
  .app-switcher a,
  .logout-link {
    min-height: 40px;
    white-space: nowrap;
  }

  .app-switcher a {
    min-height: 44px;
  }

  .app-switcher a::before {
    width: 24px;
    height: 24px;
  }

  .logout-link {
    margin-top: 0;
  }

  .layout {
    width: min(1280px, calc(100vw - 28px));
    margin: 16px auto;
  }

  .two-col,
  .reception-layout,
  .admin-layout,
  .bills-layout,
  .catalog-layout {
    grid-template-columns: 1fr;
  }

  .apps-layout {
    max-width: none;
  }

  .app-launcher {
    min-height: auto;
    grid-template-columns: 1fr;
    align-content: start;
  }

  .app-card {
    min-height: 170px;
  }

  .catalog-view-panel {
    min-height: auto;
  }

  .catalog-viewer,
  .catalog-frame-wrap {
    min-height: 520px;
    height: 66vh;
  }

  .bill-tools,
  .discount-controls,
  .split,
  .approval-main,
  .user-form,
  .user-card,
  .receipt-grid {
    grid-template-columns: 1fr;
  }

  .sticky {
    position: static;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .scan-result-grid {
    grid-template-columns: 1fr;
  }

  .head-actions {
    flex-wrap: wrap;
  }

  .variant-summary,
  .variant-footer {
    grid-template-columns: 1fr;
  }

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

  .variant-option > span:last-child {
    grid-column: 2;
  }

  .admin-product {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .admin-product .actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .admin-product-main,
  .admin-variant-row,
  .variant-edit-row {
    grid-template-columns: 1fr;
  }

  .approval-actions {
    justify-content: stretch;
  }

  .approval-actions button {
    flex: 1;
  }

  .admin-product-media {
    width: 100%;
    height: auto;
  }

  .admin-product-photo,
  .admin-product-placeholder {
    width: 100%;
    height: 160px;
  }
}

@media print {
  @page {
    size: A4;
    margin: 10mm;
  }

  @page challan {
    size: 80mm auto;
    margin: 3mm;
  }

  body {
    background: #ffffff;
  }

  body.challan-print .receipt-wrap {
    page: challan;
    width: 80mm;
  }

  .topbar,
  .print-actions,
  body > .toast {
    display: none !important;
  }

  .receipt-wrap,
  .receipt {
    margin: 0;
    width: 100%;
    border: 0;
    box-shadow: none;
  }

  .a4-receipt {
    min-height: auto;
    padding: 0;
  }

  .challan-receipt {
    padding: 0;
    font-size: 11px;
  }

  .label-sheet {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 8px;
  }

  .label {
    border: 1px solid #222222;
    padding: 8px;
    text-align: center;
    break-inside: avoid;
  }

  .label img {
    width: 128px;
    height: 154px;
    object-fit: contain;
  }

  body.print-labels > *:not(.label-sheet) {
    display: none !important;
  }
}
