:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-strong: #eef4ef;
  --ink: #17211b;
  --muted: #657368;
  --line: #dce4dd;
  --brand: #1f7a4d;
  --brand-dark: #155f3a;
  --accent: #c65f2e;
  --warning: #b45309;
  --danger: #b42318;
  --shadow: 0 16px 40px rgba(23, 33, 27, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

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

button,
input,
select,
textarea {
  font: inherit;
  min-width: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.05fr);
}

.login-panel {
  padding: clamp(28px, 6vw, 80px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 620px;
}

.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: var(--brand);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}

.brand-mark span {
  width: 32px;
  height: 32px;
  border: 4px solid #ffffff;
  border-top-color: #f7c66a;
  border-radius: 6px;
  display: block;
}

.brand-mark.small {
  width: 42px;
  height: 42px;
  box-shadow: none;
}

.brand-mark.small span {
  width: 22px;
  height: 22px;
  border-width: 3px;
}

.eyebrow {
  color: var(--brand-dark);
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 22px 0 8px;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(2.4rem, 5vw, 5.2rem);
  line-height: 0.95;
  margin-bottom: 18px;
  letter-spacing: 0;
}

.login-copy {
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.6;
  max-width: 480px;
}

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

.cloud-setup {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  padding: 12px;
}

.cloud-setup summary {
  cursor: pointer;
  color: var(--brand-dark);
  font-size: 0.86rem;
  font-weight: 900;
}

.cloud-fields {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.setup-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.45;
}

label {
  display: grid;
  gap: 7px;
  color: #2c3a31;
  font-size: 0.86rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.14);
}

.primary-action,
.secondary-action,
.ghost-action,
.icon-action {
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  min-height: 44px;
  padding: 0 16px;
}

.primary-action {
  background: var(--brand);
  color: #ffffff;
}

.primary-action:hover {
  background: var(--brand-dark);
}

.secondary-action {
  background: #17382a;
  color: #ffffff;
}

.secondary-action:hover {
  background: #0d271c;
}

.ghost-action {
  background: #e7eee8;
  color: var(--ink);
  border: 1px solid var(--line);
}

.danger-action {
  background: #fff5f4;
  color: var(--danger);
  border-color: #f5b5b0;
}

.icon-action {
  width: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  background: #17211b;
  color: #ffffff;
}

.login-visual {
  padding: clamp(28px, 6vw, 70px);
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(31, 122, 77, 0.92), rgba(19, 63, 45, 0.96)),
    radial-gradient(circle at 20% 20%, rgba(247, 198, 106, 0.42), transparent 32%),
    #17382a;
}

.shop-preview {
  width: min(440px, 100%);
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(10, 24, 17, 0.32);
  padding: 28px;
}

.preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.preview-top span {
  color: var(--muted);
  font-weight: 800;
}

.preview-top strong {
  font-size: 1.8rem;
}

.preview-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.preview-metrics article {
  min-height: 108px;
  border: 1px solid #cdd8d0;
  border-radius: 8px;
  padding: 14px;
  background: #f7faf7;
  display: grid;
  align-content: space-between;
}

.preview-metrics span,
.preview-flow span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.preview-metrics strong {
  font-size: 2rem;
}

.preview-flow {
  display: grid;
  gap: 10px;
}

.preview-flow p,
.compact-row,
.table-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.preview-flow p {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-bottom: 0;
}

.preview-flow strong {
  color: var(--brand-dark);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #15231b;
  color: #ffffff;
  padding: 22px;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.sidebar-brand strong,
.sidebar-brand span {
  display: block;
}

.sidebar-brand span,
.sidebar-footer span {
  color: #a8b9ad;
  font-size: 0.82rem;
}

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

.nav-link {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  color: #d7e2da;
  text-align: left;
  padding: 0 12px;
  font-weight: 800;
}

.nav-link:hover,
.nav-link.active {
  background: #244231;
  color: #ffffff;
}

.nav-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.72rem;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-footer strong {
  display: block;
  margin-top: 4px;
}

.main-panel {
  min-width: 0;
  padding: 24px;
}

.panel,
.table-list,
.compact-list,
.cart-lines {
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar .eyebrow {
  margin-top: 0;
}

.topbar h2 {
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  margin-bottom: 0;
  letter-spacing: 0;
}

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

.shop-switcher {
  width: min(260px, 100%);
  min-height: 42px;
  font-weight: 800;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.welcome-strip {
  min-height: 108px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  margin-bottom: 14px;
}

.welcome-strip .eyebrow {
  margin: 0 0 8px;
}

.welcome-strip h3 {
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.7rem);
  max-width: 760px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.quick-action {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 14px;
  text-align: left;
  box-shadow: var(--shadow);
}

.quick-action.primary {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

.quick-action strong,
.quick-action span {
  display: block;
}

.quick-action strong {
  font-size: 1rem;
  margin-bottom: 6px;
}

.quick-action span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.quick-action.primary span {
  color: rgba(255, 255, 255, 0.78);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

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

.kpi-card {
  padding: 18px;
  min-height: 132px;
  display: grid;
  align-content: space-between;
}

.kpi-card span,
.panel-heading span,
.table-meta,
.muted {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.kpi-card strong {
  display: block;
  font-size: clamp(1.55rem, 2.2vw, 2.3rem);
  margin: 6px 0;
}

.kpi-card small {
  color: var(--muted);
}

.dashboard-grid,
.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 14px;
}

.billing-grid,
.purchase-grid {
  align-items: start;
}

.products-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  align-items: start;
}

.settings-grid {
  align-items: start;
}

.wide {
  min-width: 0;
}

.panel {
  padding: 18px;
}

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

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

.panel-heading h3 {
  margin-bottom: 0;
  font-size: 1.02rem;
}

.insight-list,
.compact-list,
.table-list,
.cart-lines,
.note-list {
  display: grid;
  gap: 10px;
}

.insight {
  border: 1px solid var(--line);
  border-left: 5px solid var(--brand);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfb;
}

.insight.warning {
  border-left-color: var(--warning);
}

.insight.danger {
  border-left-color: var(--danger);
}

.insight strong {
  display: block;
  margin-bottom: 4px;
}

.insight p,
.note-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.compact-row,
.table-row,
.cart-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfb;
}

.compact-row strong,
.table-main strong {
  display: block;
}

.inventory-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
  gap: 10px;
  margin-bottom: 12px;
}

.search-box {
  margin-bottom: 0;
}

.table-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) repeat(4, minmax(72px, 0.5fr)) minmax(210px, 0.8fr);
  align-items: center;
  min-width: 0;
}

.customer-row {
  grid-template-columns: minmax(170px, 1fr) repeat(3, minmax(100px, 0.65fr));
}

.sales-row {
  grid-template-columns: minmax(160px, 1fr) minmax(90px, 0.5fr) minmax(90px, 0.5fr) minmax(100px, 0.55fr) minmax(142px, 0.7fr);
}

.stock-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
  background: #e8f4ec;
  color: var(--brand-dark);
}

.stock-pill.low {
  background: #fff3e4;
  color: var(--warning);
}

.stock-pill.out {
  background: #fee4e2;
  color: var(--danger);
}

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

.mini-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  font-weight: 900;
}

.mini-link {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 900;
}

.mini-danger {
  border-color: #f5b5b0;
  background: #fff5f4;
  color: var(--danger);
}

.delete-product-btn {
  min-width: 70px;
}

.scanner-card,
.customer-fields {
  display: grid;
  gap: 14px;
}

.scanner-visual {
  position: relative;
  height: 178px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.08) 50%, rgba(0, 0, 0, 0.08) 50%),
    repeating-linear-gradient(90deg, #111f17 0 6px, #eef4ef 6px 12px);
  background-size: 100% 16px, auto;
}

.scanner-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #111f17;
}

.scanner-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 48%;
  height: 3px;
  background: #e63946;
  box-shadow: 0 0 18px rgba(230, 57, 70, 0.55);
}

.scanner-status {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border-radius: 8px;
  background: rgba(23, 33, 27, 0.84);
  color: #ffffff;
  padding: 9px 10px;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.product-barcode-scanner {
  gap: 10px;
}

.product-barcode-scanner .scanner-visual {
  height: 132px;
}

.inline-control input,
.inline-control select {
  min-width: 0;
}

.barcode-entry input {
  flex: 1 1 170px;
}

.cart-count {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.cart-panel {
  position: sticky;
  top: 24px;
}

.cart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px 84px 32px;
  gap: 10px;
  align-items: center;
}

.cart-row strong,
.cart-row span {
  min-width: 0;
}

.cart-row input {
  padding: 8px;
}

.bill-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  margin: 14px 0;
  padding-top: 14px;
}

.bill-total strong {
  font-size: 1.7rem;
}

.edit-sale-notice,
.budget-status {
  border: 1px solid #f1c27d;
  border-radius: 8px;
  background: #fff8eb;
  color: #7a4b09;
  padding: 10px 12px;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.4;
}

.budget-status.ok {
  border-color: #b7d8c4;
  background: #eef8f1;
  color: var(--brand-dark);
}

.budget-status.warning {
  border-color: #f1c27d;
  background: #fff8eb;
  color: #7a4b09;
}

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

.upload-zone {
  border: 1px dashed #9aac9f;
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-strong);
  margin-bottom: 12px;
}

.file-control {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.invoice-upload {
  display: grid;
  gap: 12px;
}

.invoice-upload .helper-note {
  margin: 0;
}

.invoice-upload-actions,
.invoice-review-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.large-action {
  min-height: 58px;
  white-space: normal;
  line-height: 1.18;
}

.invoice-preview {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
}

.invoice-preview img {
  width: 88px;
  aspect-ratio: 4 / 5;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #f7faf7;
}

.invoice-preview strong,
.invoice-preview span {
  display: block;
  min-width: 0;
}

.processing-state {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 4px 10px;
  align-items: center;
  border: 1px solid #b7d8c4;
  border-radius: 8px;
  background: #eef8f1;
  color: var(--brand-dark);
  padding: 12px;
}

.processing-state p {
  grid-column: 2;
  margin: 0;
  color: var(--brand-dark);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.4;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid #b7d8c4;
  border-top-color: var(--brand);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.manual-invoice-entry {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  padding: 12px;
}

.manual-invoice-entry summary {
  cursor: pointer;
  color: var(--brand-dark);
  font-size: 0.86rem;
  font-weight: 900;
}

.manual-invoice-entry textarea {
  margin-top: 12px;
}

.invoice-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.invoice-item-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  padding: 12px;
}

.invoice-item-top,
.invoice-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.invoice-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 10px;
}

.invoice-item-footer .table-meta {
  flex: 1;
}

.success-state {
  margin-top: 12px;
  border: 1px solid #b7d8c4;
  border-radius: 8px;
  background: #eef8f1;
  color: var(--brand-dark);
  padding: 12px;
  font-weight: 900;
}

.delete-inventory-panel {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  border: 1px solid #f5b5b0;
  border-radius: 8px;
  background: #fff5f4;
  padding: 14px;
}

.delete-inventory-panel strong {
  color: var(--danger);
}

.full-width-action {
  min-height: 46px;
  border-radius: 8px;
  font-weight: 900;
}

.upload-zone p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.upload-actions {
  margin-top: 12px;
}

.scan-note {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.helper-note {
  margin: 0;
  border: 1px solid #f1c27d;
  border-radius: 8px;
  background: #fff8eb;
  color: #7a4b09;
  padding: 10px 12px;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.4;
}

.reader-note {
  margin: -2px 0 0;
  border: 1px solid #b7d8c4;
  border-radius: 8px;
  background: #eef8f1;
  color: var(--brand-dark);
  padding: 10px 12px;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.4;
}

.unknown-barcode-panel {
  display: grid;
  gap: 12px;
  border: 1px solid #f1c27d;
  border-radius: 8px;
  background: #fff8eb;
  padding: 14px;
}

.unknown-barcode-panel strong {
  display: block;
  color: #7a4b09;
  margin-bottom: 4px;
}

.unknown-barcode-panel p {
  margin: 0;
  color: #7a4b09;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.4;
}

.unknown-barcode-panel input[readonly] {
  background: #f3ead8;
  color: #7a4b09;
  font-weight: 800;
}

.empty-state {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  background: #17211b;
  color: #ffffff;
  border-radius: 8px;
  padding: 13px 16px;
  box-shadow: var(--shadow);
  transform: translateY(110px);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 20;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(16, 28, 21, 0.48);
  padding: 18px;
}

.receipt-modal {
  width: min(480px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
  padding: 18px;
}

.receipt-content {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px;
  color: #1b261f;
  background: #fbfdfb;
}

.receipt-content h4,
.receipt-content p {
  margin: 0;
}

.receipt-content h4 {
  font-size: 1.15rem;
  margin-bottom: 4px;
}

.receipt-contact {
  color: #38483d;
  font-weight: 800;
}

.receipt-line,
.receipt-total {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px 86px;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding: 5px 0;
  align-items: start;
}

.receipt-item-name {
  font-size: 0.82rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.receipt-item-qty,
.receipt-item-amount,
.receipt-total span:last-child {
  text-align: right;
  white-space: nowrap;
}

.receipt-total {
  grid-template-columns: minmax(0, 1fr) auto;
  font-weight: 900;
  font-size: 0.98rem;
  align-items: center;
}

.receipt-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  margin-top: 3px !important;
  padding-top: 5px;
  text-align: center;
}

.receipt-actions {
  margin-top: 12px;
}

.label-modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
  padding: 18px;
}

.label-product-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  color: var(--muted);
  padding: 10px 12px;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.4;
}

.label-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.checkbox-line {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding-top: 24px;
}

.checkbox-line input {
  width: auto;
}

.label-preview {
  display: grid;
  place-items: center;
  min-height: 154px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8faf8;
  padding: 16px;
  overflow: auto;
}

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

.barcode-label-grid {
  display: grid;
  justify-content: center;
  gap: 10px;
}

.barcode-label {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto minmax(12mm, 1.8fr) auto;
  align-items: center;
  width: var(--label-width);
  height: var(--label-height);
  max-width: 100%;
  border: 1px solid #d5d5d5;
  border-radius: 4px;
  background: #ffffff;
  color: #000000;
  padding: 1.8mm 2.2mm;
  text-align: center;
  overflow: hidden;
}

.barcode-label strong,
.label-price,
.label-code {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.05;
}

.barcode-label strong {
  font-size: 9px;
  font-weight: 900;
}

.label-price {
  font-size: 8px;
  font-weight: 900;
}

.label-code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 7px;
  letter-spacing: 0;
}

.barcode-svg {
  display: block;
  width: 100%;
  height: 11mm;
}

@media print {
  body.print-receipt {
    background: #ffffff;
    height: auto;
    margin: 0;
    min-height: 0;
    padding: 0;
    width: 72mm;
  }

  body.print-receipt > * {
    display: none !important;
  }

  body.print-receipt > #receiptModal {
    align-items: start;
    background: #ffffff;
    display: block !important;
    height: auto;
    min-height: 0;
    padding: 0;
    position: static;
    width: 72mm;
  }

  body.print-receipt .receipt-modal {
    box-shadow: none;
    border: 0;
    border-radius: 0;
    margin: 0;
    max-height: none;
    overflow: visible;
    padding: 0;
    width: 72mm;
  }

  body.print-receipt .panel-heading,
  body.print-receipt .receipt-actions,
  body.print-receipt #closeReceiptBtn {
    display: none;
  }

  body.print-receipt .receipt-content {
    background: #ffffff;
    border: 0;
    border-radius: 0;
    color: #000000;
    font-family: Arial, Helvetica, sans-serif;
    padding: 0 1.6mm 0.6mm;
    width: 100%;
  }

  body.print-receipt .receipt-content h4 {
    font-size: 13px;
    line-height: 1.15;
    margin-bottom: 2px;
  }

  body.print-receipt .receipt-content p {
    font-size: 10px;
    line-height: 1.2;
  }

  body.print-receipt .receipt-contact {
    color: #111111;
    font-weight: 700;
  }

  body.print-receipt .receipt-line,
  body.print-receipt .receipt-total {
    border-top: 1px solid #000000;
    grid-template-columns: minmax(0, 1fr) 9mm 19mm;
    gap: 2mm;
    padding: 1.2mm 0;
  }

  body.print-receipt .receipt-item-name,
  body.print-receipt .receipt-item-qty,
  body.print-receipt .receipt-item-amount {
    font-size: 10px;
    line-height: 1.15;
  }

  body.print-receipt .receipt-total {
    grid-template-columns: minmax(0, 1fr) auto;
    font-size: 11px;
    padding: 1.4mm 0;
  }

  body.print-receipt .receipt-footer {
    border-top: 1px solid #000000;
    color: #000000;
    font-size: 10px;
    line-height: 1.15;
    margin-top: 1mm !important;
    padding-top: 1mm;
  }

  body.print-labels * {
    visibility: hidden;
  }

  body.print-labels #labelPrintArea,
  body.print-labels #labelPrintArea * {
    visibility: visible;
  }

  body.print-labels #labelPrintArea {
    display: block !important;
    position: absolute;
    inset: 0 auto auto 0;
    background: #ffffff;
  }

  body.print-labels .barcode-label-grid {
    display: block;
  }

  body.print-labels .barcode-label {
    border: 0;
    border-radius: 0;
    break-after: page;
    box-shadow: none;
    margin: 0;
    page-break-after: always;
  }

  body.print-labels .barcode-label:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  @page {
    size: auto;
    margin: 0;
  }
}

@media (max-width: 1060px) {
  .quick-actions,
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .work-grid,
  .products-grid {
    grid-template-columns: 1fr;
  }

  .cart-panel {
    position: static;
  }

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

@media (max-width: 820px) {
  .login-shell,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .login-visual {
    display: none;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 15;
    inset: auto 0 0;
    height: auto;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    overflow-x: auto;
    scrollbar-width: none;
    box-shadow: 0 -8px 24px rgba(23, 33, 27, 0.18);
  }

  .sidebar::-webkit-scrollbar {
    display: none;
  }

  .sidebar-brand {
    display: none;
  }

  .nav-list {
    display: flex;
    gap: 6px;
    min-width: max-content;
  }

  .nav-link {
    flex: 0 0 92px;
    justify-content: center;
    min-height: 44px;
    padding: 6px 8px;
    font-size: 0.74rem;
    line-height: 1.12;
    text-align: center;
    white-space: normal;
  }

  .nav-icon,
  .sidebar-footer {
    display: none;
  }

  .main-panel {
    width: 100%;
    padding: 12px 12px calc(82px + env(safe-area-inset-bottom));
    overflow: visible;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 8;
    align-items: start;
    flex-direction: column;
    gap: 10px;
    margin: -12px -12px 14px;
    padding: 12px;
    background: rgba(245, 247, 244, 0.96);
    border-bottom: 1px solid rgba(220, 228, 221, 0.86);
    backdrop-filter: blur(10px);
  }

  .topbar h2 {
    font-size: 1.6rem;
  }

  .topbar .eyebrow {
    margin-bottom: 4px;
  }

  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .topbar-actions .shop-switcher,
  .topbar-actions .ghost-action,
  .topbar-actions .icon-action {
    min-height: 40px;
    padding-inline: 10px;
    font-size: 0.78rem;
    line-height: 1.12;
  }

  .topbar-actions .shop-switcher {
    grid-column: 1 / -1;
    width: 100%;
  }

  .topbar-actions .developer-only {
    grid-column: span 2;
  }

  .welcome-strip {
    align-items: stretch;
    flex-direction: column;
    min-height: 0;
  }

  .table-row,
  .customer-row,
  .sales-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .inventory-controls {
    grid-template-columns: 1fr;
  }

  .products-grid .panel:not(.wide) {
    order: -1;
  }

  .product-row {
    align-items: stretch;
    padding: 14px;
  }

  .product-row .table-main {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
  }

  .table-value {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 30px;
    color: var(--ink);
    font-weight: 800;
  }

  .table-value::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
  }

  .invoice-meta,
  .invoice-item-grid {
    grid-template-columns: 1fr;
  }

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

  .receipt-modal {
    width: min(480px, calc(100vw - 20px));
    max-height: calc(100dvh - 20px);
  }

  .label-modal {
    width: min(560px, calc(100vw - 20px));
    max-height: calc(100dvh - 20px);
  }

  .label-options {
    grid-template-columns: 1fr;
  }

  .checkbox-line {
    padding-top: 0;
  }

  .row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

  .row-actions > * {
    width: 100%;
    min-height: 40px;
  }

  .panel-heading {
    flex-wrap: wrap;
  }

  .panel,
  .kpi-card,
  .quick-action,
  .welcome-strip {
    box-shadow: 0 6px 18px rgba(23, 33, 27, 0.06);
  }
}

@media (max-width: 560px) {
  body {
    background: #eef4ef;
  }

  .main-panel {
    padding-inline: 10px;
  }

  .topbar h2 {
    font-size: 1.55rem;
  }

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

  .quick-actions,
  .two-col,
  .customer-fields {
    gap: 10px;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .preview-metrics {
    grid-template-columns: 1fr;
  }

  .login-panel {
    padding: 22px 16px 30px;
  }

  h1 {
    font-size: 2.25rem;
  }

  .inline-control {
    width: 100%;
  }

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

  .topbar-actions .shop-switcher,
  .topbar-actions .icon-action {
    width: 100%;
  }

  .topbar-actions .ghost-action,
  .inline-control .secondary-action,
  .inline-control .ghost-action {
    flex: 1;
  }

  .topbar-actions .ghost-action,
  .topbar-actions .icon-action,
  .inline-control .secondary-action,
  .inline-control .ghost-action,
  .inline-control .primary-action {
    padding-inline: 10px;
    font-size: 0.82rem;
    line-height: 1.15;
    white-space: normal;
  }

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

  .scanner-card .inline-control:first-of-type,
  .barcode-entry,
  .form-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .barcode-entry input {
    grid-column: 1 / -1;
  }

  .invoice-upload-actions,
  .invoice-review-actions {
    grid-template-columns: 1fr;
  }

  .invoice-preview {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .invoice-preview img {
    width: 72px;
  }

  .invoice-item-top,
  .invoice-item-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .invoice-item-footer > * {
    width: 100%;
  }

  .invoice-item-footer .mini-link {
    min-height: 44px;
  }

  .inline-control input,
  .inline-control select {
    max-width: none;
    width: 100%;
  }

  .panel,
  .kpi-card,
  .quick-action,
  .welcome-strip {
    padding: 13px;
  }

  .quick-action {
    min-height: 74px;
  }

  .quick-action strong {
    font-size: 0.94rem;
  }

  .panel-heading {
    gap: 6px;
  }

  .panel-heading span {
    font-size: 0.76rem;
  }

  .scanner-visual {
    height: 150px;
  }

  .cart-row {
    grid-template-columns: minmax(0, 1fr) 74px 38px;
    grid-template-areas:
      "name qty remove"
      "price price price";
    gap: 8px;
    align-items: center;
  }

  .cart-row > div:first-child {
    grid-area: name;
  }

  .cart-row input {
    grid-area: qty;
  }

  .cart-row > span {
    grid-area: price;
    justify-self: end;
    color: var(--brand-dark);
    font-weight: 900;
  }

  .cart-row > button {
    grid-area: remove;
  }

  .unknown-barcode-panel .two-col {
    gap: 12px;
  }

  .primary-action,
  .secondary-action,
  .ghost-action {
    min-height: 46px;
  }
}

@media (max-width: 380px) {
  .nav-link {
    flex-basis: 84px;
    font-size: 0.68rem;
    padding-inline: 5px;
  }

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

  .kpi-grid,
  .quick-actions,
  .two-col,
  .scanner-card .inline-control:first-of-type,
  .barcode-entry,
  .form-actions {
    grid-template-columns: 1fr;
  }

  .main-panel {
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
  }
}
