:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #64706b;
  --line: #d9e2dc;
  --paper: #fbfcfa;
  --panel: #ffffff;
  --green: #1f7a5b;
  --green-dark: #145842;
  --amber: #c78321;
  --red: #b8463a;
  --blue: #276b9b;
  --lavender: #6c5c95;
  --shadow: 0 18px 48px rgba(31, 55, 44, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: linear-gradient(180deg, #eef6f0 0%, #f8f7f2 42%, #edf4f7 100%);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

body.auth-locked .app-shell {
  display: none;
}

body:not(.auth-locked) .login-screen {
  display: none;
}

body.scan-mode .login-screen,
body.scan-mode .app-shell {
  display: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  padding: 18px;
  place-items: center;
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(280px, 420px);
  gap: 14px;
  align-items: start;
  width: min(880px, 100%);
}

.login-language-picker {
  grid-column: 1 / -1;
  justify-self: end;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.pos-product-card {
  grid-column: 1 / -1;
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-top: 5px solid var(--green);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.pos-product-card h2,
.pos-product-card h3,
.pos-product-card p {
  margin: 0;
}

.pos-product-card h2 {
  font-size: clamp(1.7rem, 4vw, 2.7rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.pos-product-card__lead {
  color: var(--muted);
  font-size: 1.04rem;
  font-weight: 750;
  line-height: 1.55;
}

.pos-product-media {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.65fr);
  gap: 12px;
}

.pos-product-media--photo-only {
  grid-template-columns: 1fr;
}

.pos-photo-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(260px, 1.1fr);
  gap: 12px;
  align-items: center;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.pos-photo-card h3 {
  margin: 0 0 5px;
  font-size: 1.05rem;
}

.pos-photo-card p {
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 750;
  line-height: 1.45;
}

.pos-device-preview {
  display: grid;
  min-height: 180px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #eaf5ef;
}

.pos-device-preview img {
  width: 100%;
  height: 100%;
  min-height: 180px;
  object-fit: cover;
}

.pos-help-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid #cfe2d7;
  border-radius: 8px;
  background: #eef8f2;
}

.pos-help-strip strong,
.pos-help-strip span {
  display: block;
}

.pos-help-strip strong {
  color: var(--green-dark);
  font-size: 1.05rem;
}

.pos-help-strip span {
  color: var(--muted);
  font-weight: 750;
  line-height: 1.4;
}

.pos-help-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}

.pos-product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.pos-product-feature {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.pos-product-feature h3 {
  font-size: 1rem;
}

.pos-product-feature p {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.45;
}

.pos-product-feature--highlight {
  border-color: #e5bc58;
  background: #fff8e8;
}

.pos-product-feature--highlight h3 {
  color: #7a4f00;
}

.pos-product-feature--device {
  border-color: rgba(39, 107, 155, 0.24);
  background: #eef7fb;
}

.pos-product-feature--device h3 {
  color: var(--blue);
}

.pos-product-note {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.pos-product-note span {
  padding: 10px;
  border-radius: 8px;
  background: #eef8f2;
  color: var(--green-dark);
  font-weight: 900;
  line-height: 1.35;
}

.login-card {
  width: 100%;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.login-card-header img {
  display: block;
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
}

.login-card h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.05;
}

.login-card h2 {
  margin: 0 0 14px;
  font-size: 1.45rem;
}

.login-card label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-weight: 800;
}

.scan-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(140deg, rgba(235, 247, 240, 0.95), rgba(255, 255, 255, 0.92)),
    radial-gradient(circle at top left, rgba(31, 122, 91, 0.18), transparent 32rem);
}

.scan-card {
  width: min(560px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.scan-card img {
  width: 72px;
  height: 72px;
}

.scan-card h1 {
  margin: 0;
  font-size: clamp(34px, 8vw, 52px);
  line-height: 1;
}

.scan-details {
  display: grid;
  gap: 10px;
}

.scan-details article {
  display: grid;
  grid-template-columns: minmax(92px, auto) 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.scan-details span {
  color: var(--muted);
  font-weight: 800;
}

.scan-details strong {
  color: var(--ink);
  font-size: 22px;
}

.scan-footer {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.login-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--red);
  font-weight: 800;
}

.register-status {
  color: var(--green-dark);
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.login-options .check-row {
  margin: 0;
}

.login-options .line-action {
  min-height: 40px;
}

.login-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 8px;
}

.login-action-row button {
  width: 100%;
  min-width: 0;
}

.save-status {
  min-height: 22px;
  margin: 0;
  color: var(--green-dark);
  font-size: 0.88rem;
  font-weight: 900;
}

.save-status.attention {
  color: var(--red);
}

.otp-panel {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.otp-panel[hidden] {
  display: none;
}

.module-switches {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.module-switches h4 {
  margin: 0;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 10px 0 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
  margin: 0 0 10px;
  padding: 8px 0 10px;
  background: rgba(238, 246, 240, 0.94);
  backdrop-filter: blur(10px);
}

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

.menu-toggle {
  display: inline-grid;
  place-items: center;
  gap: 4px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(31, 55, 44, 0.12);
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: var(--green-dark);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--green-dark);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 4vw, 2.35rem);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.45rem;
}

h3 {
  margin-bottom: 14px;
  font-size: 1rem;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.language-picker {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 5px 4px 12px;
  background: #ffffff;
  color: var(--muted);
}

.language-picker span {
  font-size: 0.72rem;
  font-weight: 800;
}

.language-picker select {
  min-height: 32px;
  min-width: 98px;
  border: 0;
  border-radius: 999px;
  padding: 5px 8px;
  background: #f4f8f5;
  font-weight: 800;
}

.status-pill {
  min-width: 82px;
  border: 1px solid rgba(31, 122, 91, 0.22);
  border-radius: 999px;
  padding: 10px 12px;
  background: #e8f6ef;
  color: var(--green-dark);
  text-align: center;
  font-weight: 700;
  font-size: 0.88rem;
}

.status-pill.amber {
  border-color: rgba(199, 131, 33, 0.28);
  background: #fff4df;
  color: #805114;
}

.status-pill.version-pill {
  border-color: rgba(91, 82, 143, 0.24);
  background: #f0edf7;
  color: var(--lavender);
}

.status-pill.offline {
  border-color: rgba(184, 70, 58, 0.28);
  background: #ffecea;
  color: var(--red);
}

.status-action {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: #ffffff;
  color: var(--green-dark);
  font-weight: 800;
}

.status-action.sync-action {
  border-color: rgba(31, 122, 91, 0.28);
  background: var(--green);
  color: #ffffff;
}

.status-action:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 10px;
}

.summary-grid article {
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: none;
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
}

.summary-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 1rem;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.summary-strip article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f7faf8;
}

.summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.summary-strip strong {
  display: block;
  margin-top: 6px;
  color: var(--green-dark);
  font-size: 1rem;
}

.module-layout {
  display: block;
}

.module-content {
  min-width: 0;
}

.tabbar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 8px;
  width: min(280px, calc(100vw - 44px));
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: 12px 12px 24px;
  border: 1px solid var(--line);
  border-radius: 0 8px 8px 0;
  background: #ffffff;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  transform: translateX(-110%);
  transition: transform 180ms ease;
}

.side-menu-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 4px 10px;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.drawer-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f8f5;
  color: var(--green-dark);
  font-weight: 900;
}

.menu-scrim {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  border: 0;
  background: rgba(23, 33, 29, 0.32);
}

body.menu-open {
  overflow: hidden;
}

body.menu-open .tabbar {
  transform: translateX(0);
}

body.menu-open .menu-scrim {
  display: block;
}

.tab-button,
.primary-action,
.secondary-action,
.icon-button,
.line-action {
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  font-weight: 800;
}

.tab-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 12px;
  background: #f4f8f5;
  color: var(--muted);
  text-align: left;
}

.tab-icon,
.icon-button span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(31, 122, 91, 0.1);
  color: var(--green-dark);
  font-size: 0.78rem;
}

.tab-button.active {
  background: var(--green);
  color: #ffffff;
}

.tab-button.active .tab-icon {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.tab-label {
  overflow-wrap: anywhere;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin: 18px 0 12px;
}

.sell-layout,
.master-layout,
.contacts-grid,
.report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 14px;
}

.master-layout {
  grid-template-columns: minmax(240px, 0.72fr) minmax(0, 1.28fr);
  margin-bottom: 14px;
}

.panel-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
}

.panel-actions label {
  min-width: 180px;
}

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

.stock-history {
  margin-top: 14px;
}

.compact-heading {
  margin-bottom: 12px;
}

.compact-heading h3 {
  margin: 0;
  color: var(--ink);
}

.contact-heading h3 {
  margin: 0 0 4px;
  color: var(--ink);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

input,
select {
  min-height: 46px;
  width: 100%;
  border: 1px solid #cbd8d0;
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  color: var(--ink);
}

.check-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  color: var(--ink);
}

.check-row input {
  width: 22px;
  min-height: 22px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(39, 107, 155, 0.28);
  outline-offset: 2px;
}

.catalog,
.cart-list,
.activity-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.item-card,
.cart-row,
.activity-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfb;
}

.backup-status {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.backup-status div {
  border-radius: 8px;
  padding: 10px;
  background: #f2f6f3;
}

.backup-status span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.backup-status strong {
  display: block;
  margin-top: 4px;
  color: var(--green-dark);
}

.subscription-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf8;
}

.subscription-panel h4 {
  margin: 0 0 12px;
}

.subscription-summary {
  margin-bottom: 12px;
}

.subscription-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, auto);
  gap: 10px;
}

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

#backupForm .secondary-action {
  width: 100%;
  margin-top: 10px;
}

.item-card.low {
  border-color: rgba(184, 70, 58, 0.32);
  background: #fff7f6;
}

.item-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 6px;
  font-weight: 900;
}

.item-meta,
.activity-meta {
  color: var(--muted);
  font-size: 0.84rem;
}

.field-message {
  margin: 0;
  color: var(--red);
  font-size: 0.84rem;
  font-weight: 800;
}

.line-action {
  min-width: 82px;
  padding: 0 12px;
  background: #e8f1f7;
  color: var(--blue);
}

.line-action.danger {
  background: #fae9e6;
  color: var(--red);
}

.primary-action {
  padding: 0 18px;
  background: var(--green);
  color: #ffffff;
}

.invoice-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, minmax(130px, auto));
  gap: 10px;
}

.form-actions {
  grid-column: 1 / -1;
}

.supplier-note-actions {
  grid-template-columns: 1fr;
  max-width: 420px;
}

.supplier-note-actions button {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 10px 14px;
  line-height: 1.2;
  white-space: normal;
}

.print-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.print-action:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.whatsapp-action {
  border-color: rgba(31, 122, 91, 0.32);
  background: #e8f6ef;
  color: var(--green-dark);
}

.qr-action {
  border-color: rgba(39, 107, 155, 0.32);
  background: #e8f1f7;
  color: var(--blue);
}

.printer-mark {
  position: relative;
  display: inline-block;
  width: 22px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.printer-mark::before,
.printer-mark::after {
  position: absolute;
  content: "";
  left: 4px;
  width: 10px;
  border: 2px solid currentColor;
  background: #ffffff;
}

.printer-mark::before {
  top: -9px;
  height: 7px;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
}

.printer-mark::after {
  bottom: -8px;
  height: 8px;
  border-radius: 2px;
}

.secondary-action,
.icon-button {
  border: 1px solid var(--line);
  padding: 0 14px;
  background: #ffffff;
  color: var(--green-dark);
}

.icon-button {
  width: 46px;
  padding: 0;
}

.inline-fields,
.document-filters,
.stock-history-filters,
.contact-form,
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.customer-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, auto);
  gap: 8px;
  align-items: end;
}

.customer-select-row .secondary-action {
  min-height: 46px;
  padding: 0 12px;
  white-space: nowrap;
}

.document-filters,
.stock-history-filters {
  align-items: end;
}

.report-filters {
  grid-template-columns: repeat(2, minmax(0, 220px));
}

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

.report-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 14px;
}

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

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

.contact-form {
  margin-top: 14px;
}

.wide-field {
  grid-column: 1 / -1;
}

.contact-form .primary-action {
  align-self: end;
}

.staff-account-panel,
.password-change-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f7faf8;
}

.staff-account-panel h4,
.password-change-panel h4 {
  margin: 0;
  color: var(--ink);
}

.staff-account-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 130px minmax(120px, auto);
  gap: 10px;
  align-items: end;
}

.logo-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.logo-preview img {
  width: min(220px, 100%);
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  padding: 6px;
  background: #ffffff;
}

.form-grid h3 {
  grid-column: 1 / -1;
}

.form-grid .primary-action {
  align-self: end;
}

.cart-row {
  grid-template-columns: 1fr;
}

.bag-cart-row {
  gap: 12px;
}

.cart-line-head {
  min-width: 0;
}

.bag-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.bag-summary span {
  border-radius: 8px;
  padding: 8px 10px;
  background: #f2f6f3;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.bag-summary strong {
  display: block;
  margin-top: 3px;
  color: var(--green-dark);
  font-size: 0.95rem;
}

.invoice-price-field,
.invoice-description-field {
  border-radius: 8px;
  padding: 8px 10px;
  background: #f2f6f3;
}

.stock-bag-panel {
  display: grid;
  gap: 8px;
}

.invoice-price-field span,
.invoice-description-field span {
  display: block;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.invoice-price-field input,
.invoice-description-field input {
  min-height: 34px;
  margin-top: 4px;
  padding: 6px 8px;
  font-weight: 900;
}

.icon-mini {
  min-width: 30px;
  height: 30px;
  padding: 0;
}

.bag-entry-table {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.bag-entry-table table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.bag-entry-table th,
.bag-entry-table td {
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.bag-entry-table th {
  background: #f2f6f3;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

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

.bag-entry-table td:first-child {
  width: 48px;
  font-weight: 900;
  color: var(--green-dark);
}

.bag-entry-table td:nth-child(2) {
  width: 86px;
}

.bag-entry-table td:nth-child(3) {
  width: auto;
}

.bag-entry-table td:nth-child(4) {
  width: 94px;
}

.bag-entry-table td:last-child {
  width: 44px;
  text-align: right;
}

.bag-entry-table input {
  width: 100%;
  min-height: 40px;
  padding: 8px 8px;
  font-size: 1rem;
  font-weight: 900;
}

.simple-entry-table td:first-child,
.simple-entry-table td:nth-child(2) {
  width: 38%;
}

.simple-entry-table td:last-child {
  width: 24%;
}

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

.bag-actions button {
  min-height: 42px;
}

.totals {
  display: grid;
  grid-template-columns: 1fr 0.7fr 0.7fr;
  gap: 12px;
  align-items: end;
  margin: 14px 0;
}

.totals div {
  border-radius: 8px;
  padding: 10px 12px;
  background: #f2f6f3;
}

.totals span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.totals strong {
  display: block;
  margin-top: 5px;
  color: var(--green-dark);
  font-size: 1.15rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

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

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

th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

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

.badge {
  display: inline-flex;
  min-width: 64px;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 9px;
  background: #edf5f0;
  color: var(--green-dark);
  font-size: 0.75rem;
  font-weight: 800;
}

.badge.red {
  background: #ffecea;
  color: var(--red);
}

.badge.blue {
  background: #e8f1f7;
  color: var(--blue);
}

.badge.lavender {
  background: #f0edf7;
  color: var(--lavender);
}

.receipt {
  display: none;
}

.confirmation-modal[hidden] {
  display: none;
}

.confirmation-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(9, 25, 18, 0.52);
}

.confirmation-card {
  width: min(420px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.label-print-card {
  width: min(560px, 100%);
}

.label-print-card .activity-row {
  grid-template-columns: minmax(0, 1fr) minmax(112px, auto);
}

.confirmation-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.confirmation-heading h2 {
  margin: 0;
  font-size: 1.35rem;
}

.receipt-preview {
  width: min(58mm, 100%);
  margin: 0 auto 14px;
  padding: 3mm;
  border: 1px dashed #b8c5bd;
  background: #ffffff;
  color: #000000;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  line-height: 1.3;
}

.receipt-preview .receipt-brand {
  display: flex;
  align-items: center;
  gap: 2mm;
  padding-bottom: 2mm;
  border-bottom: 1px dashed #000000;
}

.receipt-preview .farmer-note-bill-header {
  padding-bottom: 2mm;
  border-bottom: 1px dashed #000000;
}

.receipt-preview .farmer-note-bill-header img {
  display: block;
  width: 100%;
  height: auto;
  filter: grayscale(1) contrast(1.12);
}

.receipt-preview .receipt-logo {
  width: 16mm;
  height: 16mm;
  flex: 0 0 16mm;
  object-fit: contain;
}

.receipt-preview h2,
.receipt-preview p {
  margin: 0;
}

.receipt-preview h2 {
  font-size: 15px;
  line-height: 1.15;
}

.receipt-preview .receipt-buyer-details,
.receipt-preview .receipt-meta {
  display: grid;
  gap: 1mm;
  margin-top: 1mm;
  font-size: 10px;
}

.receipt-preview .receipt-title {
  display: block;
  margin: 2mm 0 1mm;
  text-align: center;
  text-transform: uppercase;
  font-size: 12px;
}

.receipt-preview .receipt-lines {
  margin-top: 2mm;
  border-top: 1px dashed #000000;
  border-bottom: 1px dashed #000000;
}

.receipt-preview .receipt-lines p {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5mm;
  padding: 1.5mm 0;
}

.receipt-preview .receipt-invoice-item {
  padding: 1.5mm 0;
  border-bottom: 1px dotted #999999;
}

.receipt-preview .receipt-invoice-item:last-child {
  border-bottom: 0;
}

.receipt-preview .receipt-bag-details,
.receipt-preview .receipt-grade-summary,
.receipt-preview .receipt-line-summary {
  display: grid;
  gap: 0.7mm;
  margin-top: 1mm;
}

.receipt-preview .receipt-bag-details > span,
.receipt-preview .receipt-line-summary span {
  display: flex;
  justify-content: space-between;
  gap: 2mm;
}

.receipt-preview .receipt-grade-summary > span {
  display: block;
  font-weight: 800;
}

.receipt-preview .receipt-grade-summary {
  padding-top: 1mm;
  border-top: 1px dashed #999999;
}

.receipt-preview .receipt-total {
  display: grid;
  gap: 1mm;
  margin-top: 2mm;
  font-size: 11px;
  text-align: right;
}

.receipt-preview .receipt-bank-details {
  display: grid;
  gap: 0.8mm;
  margin-top: 2mm;
  padding-top: 2mm;
  border-top: 1px dashed #000000;
  font-size: 10px;
}

.receipt-preview .receipt-solution {
  margin: 3mm 0 0;
  padding-top: 2mm;
  border-top: 1px dashed #000000;
  text-align: center;
  font-size: 10px;
  font-weight: 800;
}

.receipt-preview.print-normal {
  font-size: 10px;
}

.receipt-preview.print-normal .receipt-logo {
  width: 13mm;
  height: 13mm;
  flex-basis: 13mm;
}

.receipt-preview.logo-normal .receipt-logo {
  width: 13mm;
  height: 13mm;
  flex-basis: 13mm;
}

.receipt-preview.logo-large .receipt-logo {
  width: 18mm;
  height: 18mm;
  flex-basis: 18mm;
}

.receipt-preview.logo-xlarge .receipt-logo {
  width: 23mm;
  height: 23mm;
  flex-basis: 23mm;
}

.receipt-preview.logo-banner .receipt-brand {
  display: block;
  text-align: center;
}

.receipt-preview.logo-banner .receipt-logo {
  display: block;
  width: 100%;
  height: auto;
  max-height: 28mm;
  margin: 0 auto 1.5mm;
  object-fit: contain;
}

.receipt-preview.print-normal h2 {
  font-size: 14px;
}

.receipt-preview.print-normal .receipt-buyer-details,
.receipt-preview.print-normal .receipt-meta,
.receipt-preview.print-normal .receipt-solution {
  font-size: 9px;
}

.receipt-preview.print-normal .receipt-title,
.receipt-preview.print-normal .receipt-total {
  font-size: 11px;
}

.receipt-preview.print-large {
  font-size: 11px;
}

.receipt-preview.print-xlarge {
  font-size: 12px;
}

.receipt-preview.print-xlarge h2 {
  font-size: 17px;
}

.receipt-preview.print-xlarge .receipt-buyer-details,
.receipt-preview.print-xlarge .receipt-meta,
.receipt-preview.print-xlarge .receipt-solution {
  font-size: 11px;
}

.receipt-preview.print-xlarge .receipt-title,
.receipt-preview.print-xlarge .receipt-total {
  font-size: 13px;
}

.confirmation-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

@media (max-width: 860px) {
  .login-layout {
    grid-template-columns: 1fr;
  }

  .pos-product-grid,
  .pos-product-note,
  .pos-product-media,
  .pos-photo-card,
  .pos-help-strip {
    grid-template-columns: 1fr;
  }

  .pos-product-card {
    padding: 18px;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-strip {
    justify-content: flex-start;
    width: 100%;
  }

  .language-picker {
    align-items: center;
    flex-direction: row;
  }

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

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

  .module-layout {
    display: block;
  }

  .tabbar {
    height: 100vh;
    height: 100dvh;
  }

  .tab-button {
    min-width: 0;
    gap: 8px;
    padding: 11px 9px;
    font-size: 0.84rem;
  }

  .sell-layout,
  .master-layout,
  .contacts-grid,
  .report-grid,
  .inline-fields,
  .document-filters,
  .report-filters,
  .report-summary-grid,
  .stock-history-filters,
  .customer-select-row,
  .contact-form,
  .staff-account-form,
  .form-grid,
  .invoice-actions,
  .totals {
    grid-template-columns: 1fr;
  }

  .panel-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .panel-actions label {
    min-width: 0;
  }

  .backup-status {
    grid-template-columns: 1fr;
  }

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

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

  .bag-entry-table table {
    min-width: 0;
  }

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

  .bag-actions button {
    flex: 1 1 140px;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 10px, 1180px);
    padding-top: 4px;
  }

  .module-layout {
    display: block;
  }

  .tabbar {
    width: min(256px, calc(100vw - 38px));
    height: 100vh;
    height: 100dvh;
    padding: 10px 10px 24px;
  }

  .side-menu-title {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  .tab-button {
    justify-content: flex-start;
    min-height: 52px;
    padding: 11px 9px;
  }

  .tab-icon {
    width: 30px;
    height: 30px;
  }

  .tab-label {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  .menu-toggle {
    width: 40px;
    height: 40px;
  }

  .brand-row h1 {
    font-size: 1.42rem;
  }

  .brand-row .eyebrow {
    max-width: 180px;
  }

  .status-pill {
    min-width: 76px;
    padding: 8px 10px;
    font-size: 0.82rem;
  }

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

  .bag-entry-table th,
  .bag-entry-table td {
    padding: 5px 4px;
    font-size: 0.76rem;
  }

  .bag-entry-table input {
    min-height: 36px;
    padding: 6px 5px;
    font-size: 0.9rem;
  }

  .language-picker {
    min-height: 38px;
  }

  .language-picker select {
    min-width: 90px;
  }
}

@media (max-width: 380px) {
  .brand-row .eyebrow {
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .cart-row {
    grid-template-columns: 1fr;
  }

  .item-card,
  .activity-row {
    grid-template-columns: 1fr;
  }

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

  .line-action {
    width: 100%;
  }
}

@media print {
  @page {
    size: 58mm auto;
    margin: 0;
  }

  html,
  body {
    width: 58mm;
    min-height: 0;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }

  .app-shell {
    display: none !important;
  }

  .login-screen,
  .confirmation-modal {
    display: none !important;
  }

  .receipt {
    display: block !important;
    width: 58mm;
    max-width: 58mm;
    margin: 0;
    padding: 3mm;
    box-sizing: border-box;
    background: #ffffff;
    color: #000000;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    line-height: 1.3;
  }

  .receipt.label-print {
    padding: 2mm;
  }

  .receipt.label-print .bag-label {
    display: grid;
    gap: 1.5mm;
    min-height: 42mm;
    padding: 2mm 0;
    border-bottom: 1px dashed #000000;
    page-break-after: always;
    break-after: page;
  }

  .receipt.label-print .bag-label:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  .bag-label-main {
    display: grid;
    grid-template-columns: 1fr 30mm;
    gap: 2mm;
    align-items: start;
  }

  .bag-label-main div {
    display: grid;
    gap: 0.8mm;
  }

  .bag-label-title {
    font-size: 12px;
    line-height: 1.15;
  }

  .bag-label-qr {
    width: 30mm;
    height: 30mm;
    object-fit: contain;
    background: #ffffff;
    padding: 1.5mm;
  }

  .bag-label-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1mm 2mm;
    align-items: baseline;
    padding-top: 1mm;
    border-top: 1px dashed #000000;
  }

  .bag-label-item strong {
    grid-column: 1 / -1;
    font-size: 15px;
  }

  .bag-label-item b {
    font-size: 18px;
  }

  .receipt.label-print p {
    padding-top: 1mm;
    border-top: 1px dashed #000000;
    text-align: center;
    font-size: 9px;
    font-weight: 800;
  }

  .receipt-brand {
    display: flex;
    align-items: center;
    gap: 2mm;
    padding-bottom: 2mm;
    border-bottom: 1px dashed #000000;
  }

  .farmer-note-bill-header {
    padding-bottom: 2mm;
    border-bottom: 1px dashed #000000;
  }

  .farmer-note-bill-header img {
    display: block;
    width: 100%;
    height: auto;
    filter: grayscale(1) contrast(1.12);
  }

  .receipt-logo {
    width: 16mm;
    height: 16mm;
    flex: 0 0 16mm;
    object-fit: contain;
  }

  .receipt h2,
  .receipt p {
    margin: 0;
  }

  .receipt h2 {
    font-size: 15px;
    line-height: 1.15;
  }

  .receipt-buyer-details,
  .receipt-meta {
    display: grid;
    gap: 1mm;
    margin-top: 1mm;
    font-size: 10px;
  }

  .receipt-title {
    display: block;
    margin: 2mm 0 1mm;
    text-align: center;
    text-transform: uppercase;
    font-size: 12px;
  }

  .receipt-lines {
    margin-top: 2mm;
    border-top: 1px dashed #000000;
    border-bottom: 1px dashed #000000;
  }

  .receipt-lines p {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5mm;
    padding: 1.5mm 0;
    border-bottom: 1px dotted #999999;
  }

  .receipt-lines p:last-child {
    border-bottom: 0;
  }

  .receipt-invoice-item {
    padding: 1.5mm 0;
    border-bottom: 1px dotted #999999;
  }

  .receipt-invoice-item:last-child {
    border-bottom: 0;
  }

  .receipt-bag-details,
  .receipt-grade-summary,
  .receipt-line-summary {
    display: grid;
    gap: 0.7mm;
    margin-top: 1mm;
  }

  .receipt-bag-details > span,
  .receipt-line-summary span {
    display: flex;
    justify-content: space-between;
    gap: 2mm;
  }

  .receipt-grade-summary > span {
    display: block;
    font-weight: 800;
  }

  .receipt-grade-summary {
    padding-top: 1mm;
    border-top: 1px dashed #999999;
  }

  .receipt-total {
    display: grid;
    gap: 1mm;
    margin-top: 2mm;
    font-size: 12px;
    text-align: right;
  }

  .receipt-bank-details {
    display: grid;
    gap: 0.8mm;
    margin-top: 2mm;
    padding-top: 2mm;
    border-top: 1px dashed #000000;
    font-size: 10px;
  }

  .receipt-solution {
    margin: 3mm 0 0;
    padding-top: 2mm;
    border-top: 1px dashed #000000;
    text-align: center;
    font-size: 10px;
    font-weight: 800;
  }

  .receipt.print-normal {
    font-size: 10px;
  }

  .receipt.print-normal .receipt-logo {
    width: 13mm;
    height: 13mm;
    flex-basis: 13mm;
  }

  .receipt.logo-normal .receipt-logo {
    width: 13mm;
    height: 13mm;
    flex-basis: 13mm;
  }

  .receipt.logo-large .receipt-logo {
    width: 18mm;
    height: 18mm;
    flex-basis: 18mm;
  }

  .receipt.logo-xlarge .receipt-logo {
    width: 23mm;
    height: 23mm;
    flex-basis: 23mm;
  }

  .receipt.logo-banner .receipt-brand {
    display: block;
    text-align: center;
  }

  .receipt.logo-banner .receipt-logo {
    display: block;
    width: 100%;
    height: auto;
    max-height: 28mm;
    margin: 0 auto 1.5mm;
    object-fit: contain;
  }

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

  .receipt.print-normal .receipt-buyer-details,
  .receipt.print-normal .receipt-meta,
  .receipt.print-normal .receipt-solution {
    font-size: 9px;
  }

  .receipt.print-normal .receipt-title,
  .receipt.print-normal .receipt-total {
    font-size: 11px;
  }

  .receipt.print-large {
    font-size: 11px;
  }

  .receipt.print-xlarge {
    font-size: 12px;
  }

  .receipt.print-xlarge h2 {
    font-size: 17px;
  }

  .receipt.print-xlarge .receipt-buyer-details,
  .receipt.print-xlarge .receipt-meta,
  .receipt.print-xlarge .receipt-solution {
    font-size: 11px;
  }

  .receipt.print-xlarge .receipt-title,
  .receipt.print-xlarge .receipt-total {
    font-size: 13px;
  }
}
