:root {
  --bg: #030303;
  --panel: #0c0c0c;
  --panel-2: #121212;
  --line: #2a2a2a;
  --line-strong: #f4f1e8;
  --text: #f4f1e8;
  --muted: #8a8a8a;
  --red: #ef1d0b;
  --red-dark: #9f1309;
  --green: #21a565;
  --amber: #d9a920;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 72% 33%, rgba(239, 29, 11, 0.18), transparent 18rem),
    linear-gradient(90deg, rgba(239, 29, 11, 0.12) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    #030303;
  background-size: auto, 96px 96px, 96px 96px, auto;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

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

button,
.linkButton,
.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 0 14px;
  text-decoration: none;
  text-transform: uppercase;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
}

button:hover,
.linkButton:hover,
.tab:hover {
  border-color: var(--red);
  transform: translateY(-1px);
}

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

.fieldButton {
  align-self: end;
  min-height: 44px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #343434;
  border-radius: 2px;
  background: #070707;
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239, 29, 11, 0.18);
}

textarea {
  min-height: 92px;
  padding: 12px;
  resize: vertical;
}

.appShell {
  width: min(1540px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 46px;
}

.topBar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  min-height: 112px;
  border-bottom: 1px solid rgba(244, 241, 232, 0.16);
}

.brandLockup {
  display: grid;
  grid-template-columns: minmax(180px, 300px) minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  min-width: 0;
}

.brandLockup > div {
  min-width: 0;
}

.brandLockup img {
  width: 100%;
  max-width: 300px;
  height: auto;
  border: 1px solid rgba(244, 241, 232, 0.22);
  object-fit: contain;
}

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

.topBar h1 {
  margin-bottom: 0;
  font-size: clamp(2.6rem, 4.9vw, 5.35rem);
  font-weight: 1000;
  letter-spacing: 0;
  line-height: 0.9;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.panel h2 {
  margin-bottom: 0;
  font-size: clamp(1.3rem, 2vw, 2rem);
  font-weight: 950;
  line-height: 1.03;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.panel h3 {
  margin-bottom: 0;
  font-size: 1.1rem;
  text-transform: uppercase;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.topActions,
.actionStrip,
.slipFooter {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topActions {
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 260px;
}

.redSignal {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 22px rgba(239, 29, 11, 0.72);
}

.statusPill,
.userBadge,
.stockBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid rgba(244, 241, 232, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  white-space: nowrap;
}

.userBadge {
  border-color: rgba(33, 165, 101, 0.45);
  color: #c8ffe1;
}

.statusPill.ok {
  border-color: rgba(33, 165, 101, 0.45);
  color: #c8ffe1;
}

.statusPill.empty {
  color: #bcbcbc;
}

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

.metricStrip div {
  border: 1px solid rgba(244, 241, 232, 0.16);
  background: rgba(255, 255, 255, 0.035);
  padding: 14px;
}

.metricStrip span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.metricStrip strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.45rem, 3vw, 2.55rem);
  line-height: 0.9;
}

.tabBar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 0 18px;
}

.tab {
  flex: 0 0 auto;
  border-color: rgba(244, 241, 232, 0.22);
  color: var(--muted);
}

.tab.active {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.workspace {
  display: grid;
  gap: 16px;
}

.twoColumn {
  grid-template-columns: minmax(340px, 0.95fr) minmax(390px, 1.05fr);
}

.inventoryLayout {
  grid-template-columns: minmax(520px, 0.98fr) minmax(520px, 1.02fr);
  align-items: start;
}

.panel {
  border: 1px solid rgba(244, 241, 232, 0.18);
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(18, 18, 18, 0.98), rgba(9, 9, 9, 0.98));
  box-shadow: var(--shadow);
  padding: 18px;
}

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

.panelHeader.compact {
  align-items: center;
  margin-bottom: 10px;
}

.fieldLabel,
.formGrid label,
.stackForm label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.microcopy,
.complianceNote,
.bodyText {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.microcopy.ok {
  color: #bcffd9;
}

.microcopy.error {
  color: #ffb2aa;
}

.cameraFrame {
  position: relative;
  overflow: hidden;
  width: 100%;
  margin-top: 12px;
  border: 1px solid var(--red);
  border-radius: 4px;
  aspect-ratio: 16 / 9;
  background: #000;
}

.cameraFrame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cameraFrame span {
  position: absolute;
  inset: auto 18% 42%;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 2px;
  color: transparent;
}

.scanOverlay {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.82);
  padding: 18px;
}

.scanModal {
  width: min(100%, 620px);
  border: 1px solid rgba(244, 241, 232, 0.22);
  border-radius: 4px;
  background: linear-gradient(180deg, #111, #050505);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.72);
  padding: 16px;
}

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

.scanHead h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 5vw, 2.4rem);
  font-weight: 1000;
  line-height: 0.95;
  text-transform: uppercase;
}

.scanClose {
  flex: 0 0 auto;
  width: 44px;
  min-height: 44px;
  padding: 0;
}

.scanVideoWrap {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--red);
  border-radius: 4px;
  aspect-ratio: 4 / 3;
  background: #000;
}

.scanVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanFrame {
  position: absolute;
  inset: 36% 10%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 3px;
  box-shadow:
    0 0 0 999px rgba(0, 0, 0, 0.16),
    0 0 24px rgba(239, 29, 11, 0.45);
  pointer-events: none;
}

.scanStatus {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.scanStatus.ok {
  color: #bcffd9;
}

.scanStatus.error {
  color: #ffb2aa;
}

.articleList,
.compactTable,
.slipLines {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.articleList {
  max-height: min(58vh, 640px);
  border: 1px solid rgba(244, 241, 232, 0.14);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.24);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px;
}

.articleList::-webkit-scrollbar,
.inventoryTable::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.articleList::-webkit-scrollbar-track,
.inventoryTable::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
}

.articleList::-webkit-scrollbar-thumb,
.inventoryTable::-webkit-scrollbar-thumb {
  border: 2px solid #080808;
  border-radius: 999px;
  background: rgba(244, 241, 232, 0.32);
}

.articleList::-webkit-scrollbar-thumb:hover,
.inventoryTable::-webkit-scrollbar-thumb:hover {
  background: rgba(239, 29, 11, 0.72);
}

.articleRow,
.tableRow {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  border: 1px solid rgba(244, 241, 232, 0.14);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
}

.articleRow {
  width: 100%;
  min-height: 70px;
  justify-content: stretch;
  letter-spacing: 0;
  text-transform: none;
}

.articleMain {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.articleThumb {
  width: 52px;
  height: 52px;
  border: 1px solid rgba(244, 241, 232, 0.18);
  border-radius: 3px;
  background: #050505;
  object-fit: cover;
}

.articleThumb.empty {
  display: block;
  background:
    linear-gradient(135deg, transparent 47%, rgba(244, 241, 232, 0.12) 48%, rgba(244, 241, 232, 0.12) 52%, transparent 53%),
    #070707;
}

.articleRow.selected {
  border-color: var(--red);
  background: rgba(239, 29, 11, 0.13);
}

.articleRow strong,
.tableRow strong {
  display: block;
  font-size: 0.98rem;
}

.articleRow small,
.tableRow small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.stockBadge.ok {
  border-color: rgba(33, 165, 101, 0.55);
  color: #bcffd9;
}

.stockBadge.low {
  border-color: rgba(217, 169, 32, 0.55);
  color: #ffe199;
}

.stockBadge.empty {
  color: #bcbcbc;
}

.stockBadge.minus {
  border-color: rgba(239, 29, 11, 0.58);
  color: #ffb2aa;
}

.detailPanel {
  align-self: start;
}

.factsGrid,
.formGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stackForm {
  display: grid;
  gap: 12px;
}

.wideField,
.wideButton {
  grid-column: 1 / -1;
}

.widePanel {
  grid-column: 1 / -1;
}

.factsGrid {
  margin: 0 0 14px;
}

.factsGrid div,
.formulaBox {
  border: 1px solid rgba(244, 241, 232, 0.14);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.035);
  padding: 12px;
}

.factsGrid dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.factsGrid dd {
  margin: 5px 0 0;
  font-weight: 900;
}

.articlePreview {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
}

.articlePreview.compact {
  max-width: 260px;
}

.articlePreview img {
  width: min(100%, 320px);
  max-height: 240px;
  border: 1px solid rgba(244, 241, 232, 0.18);
  border-radius: 3px;
  background: #050505;
  object-fit: contain;
}

.articlePreview figcaption {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dangerButton {
  border-color: var(--red);
  background: var(--red);
}

.slipBox {
  margin-top: 18px;
  border-top: 1px solid rgba(244, 241, 232, 0.22);
  padding-top: 16px;
}

.slipLine {
  display: grid;
  grid-template-columns: 1fr 76px 108px 36px;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(244, 241, 232, 0.14);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.035);
  padding: 10px;
}

.slipLine input {
  text-align: center;
}

.removeLine {
  width: 34px;
  min-height: 34px;
  padding: 0;
}

.slipFooter {
  justify-content: space-between;
  margin: 12px 0 8px;
  border-top: 1px solid rgba(244, 241, 232, 0.16);
  padding-top: 10px;
}

.movementRow {
  grid-template-columns: 1fr auto auto;
}

.inventoryTable {
  max-height: 68vh;
  margin-top: 14px;
  border: 1px solid rgba(244, 241, 232, 0.14);
  overflow: auto;
}

.inventoryHead,
.inventoryRow {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 96px 116px 132px;
  align-items: center;
  gap: 10px;
  min-width: 760px;
  padding: 10px 12px;
}

.inventoryHead {
  position: sticky;
  z-index: 1;
  top: 0;
  border-bottom: 1px solid rgba(244, 241, 232, 0.16);
  background: #0b0b0b;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.inventoryRow {
  border-bottom: 1px solid rgba(244, 241, 232, 0.08);
  color: var(--text);
  text-decoration: none;
}

.inventoryRow:hover,
.inventoryRow.selected {
  background: rgba(239, 29, 11, 0.14);
}

.inventoryRow.selected {
  box-shadow: inset 3px 0 0 var(--red);
}

.inventoryRow.inactive {
  opacity: 0.5;
}

.inventoryRow strong {
  display: block;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.inventoryRow small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
}

.sectionDivider {
  margin: 18px 0;
  border-top: 1px solid rgba(244, 241, 232, 0.18);
}

.journalPanel {
  margin-top: 16px;
}

.formGrid .checkLine,
.checkLine {
  display: flex;
  align-items: center;
  min-height: 44px;
  gap: 10px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.formGrid .checkLine input,
.checkLine input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--red);
}

.changeHelper {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(150px, 0.7fr) minmax(150px, 0.7fr);
  align-items: end;
  gap: 12px;
  margin: 12px 0;
  border: 1px solid rgba(244, 241, 232, 0.14);
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
}

.changeHelper .microcopy {
  margin-bottom: 0;
}

.changeHelper label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.changeResult {
  min-height: 44px;
  border: 1px solid rgba(244, 241, 232, 0.18);
  background: rgba(255, 255, 255, 0.035);
  padding: 8px 10px;
}

.changeResult span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.changeResult strong {
  display: block;
  margin-top: 3px;
}

.changeResult strong.minus {
  color: #ffb2aa;
}

.printFormatControl {
  display: grid;
  gap: 5px;
  min-width: 132px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.printFormatControl select {
  min-height: 42px;
}

.codeBox {
  border: 1px solid rgba(244, 241, 232, 0.14);
  background: #050505;
  color: #c8ffe1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  padding: 12px;
}

.summaryPanel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.cashValue {
  font-size: clamp(2rem, 5vw, 4.4rem);
  font-weight: 1000;
  line-height: 0.9;
}

.flash {
  margin: 12px 0;
  border: 1px solid rgba(244, 241, 232, 0.2);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.05);
  padding: 12px;
}

.flash.ok {
  border-color: rgba(33, 165, 101, 0.55);
}

.flash.error {
  border-color: rgba(239, 29, 11, 0.65);
}

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

.loginPanel {
  width: min(100%, 470px);
  border: 1px solid rgba(244, 241, 232, 0.2);
  border-radius: 4px;
  background: rgba(8, 8, 8, 0.97);
  box-shadow: var(--shadow);
  padding: 24px;
}

.loginLogo {
  width: 100%;
  border: 1px solid rgba(244, 241, 232, 0.2);
  margin-bottom: 20px;
}

.loginPanel h1 {
  margin-bottom: 20px;
  font-size: clamp(2rem, 8vw, 3rem);
  line-height: 0.95;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

#printSlip {
  display: none;
}

@media (max-width: 900px) {
  .appShell {
    width: min(100% - 20px, 760px);
    padding-top: 12px;
  }

  .topBar,
  .brandLockup,
  .panelHeader {
    display: flex;
    align-items: stretch;
    flex-direction: column;
  }

  .brandLockup img {
    width: min(100%, 300px);
  }

  .topActions {
    justify-content: flex-start;
    max-width: none;
  }

  .metricStrip,
  .twoColumn,
  .inventoryLayout,
  .factsGrid,
  .formGrid {
    grid-template-columns: 1fr;
  }

  .wideField,
  .wideButton,
  .fieldButton {
    grid-column: auto;
  }

  .slipLine {
    grid-template-columns: 1fr 72px 36px;
  }

  .slipLine strong:last-of-type {
    grid-column: 1 / -1;
  }

  .actionStrip {
    flex-wrap: wrap;
  }

  .changeHelper {
    grid-template-columns: 1fr;
  }

  .articleList {
    max-height: 52vh;
  }

  .scanOverlay {
    align-items: start;
    padding: 12px;
  }

  .scanModal {
    padding: 12px;
  }

  .scanVideoWrap {
    aspect-ratio: 3 / 4;
  }

  .inventoryHead,
  .inventoryRow {
    grid-template-columns: minmax(320px, 1fr) 86px 108px 122px;
  }
}

@page slipA4 {
  size: A4 portrait;
  margin: 0;
}

@page slipReceipt {
  size: 80mm 210mm;
  margin: 0;
}

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .appShell {
    display: none;
  }

  #printSlip {
    display: block;
    color: #000;
    font-family: Arial, Helvetica, sans-serif;
  }

  #printSlip.printA4 {
    page: slipA4;
    padding: 12mm;
  }

  #printSlip.printReceipt {
    page: slipReceipt;
    width: 80mm;
    padding: 4mm 3mm;
    font-size: 9pt;
  }

  .printLogo {
    display: inline-grid;
    gap: 1.8mm;
    border: 0.7mm solid #000;
    color: #000;
    padding: 2.2mm 3mm 2mm;
    line-height: 1;
  }

  .printLogo strong {
    display: block;
    font-size: 21pt;
    font-weight: 1000;
    letter-spacing: 0;
  }

  .printLogo span {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2mm;
    border-top: 0.35mm solid #000;
    padding-top: 1.1mm;
    font-size: 5.6pt;
    font-weight: 900;
    letter-spacing: 0.2em;
  }

  .printLogo i {
    display: inline-block;
    width: 3.1mm;
    height: 3.1mm;
    border-radius: 999px;
    background: #ef1d0b;
  }

  #printSlip.printReceipt .printLogo {
    width: 100%;
    padding: 1.8mm 2mm 1.7mm;
  }

  #printSlip.printReceipt .printLogo strong {
    font-size: 18pt;
  }

  #printSlip.printReceipt .printLogo span {
    font-size: 4.6pt;
  }

  #printSlip.printReceipt .printLogo i {
    width: 2.5mm;
    height: 2.5mm;
  }

  #printSlip h1 {
    margin: 8mm 0 2mm;
    font-size: 20pt;
    text-transform: uppercase;
  }

  #printSlip.printReceipt h1 {
    margin: 5mm 0 1.6mm;
    font-size: 15pt;
  }

  #printSlip.printReceipt p {
    margin-bottom: 4mm;
  }

  #printSlip table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8mm;
  }

  #printSlip.printReceipt table {
    margin-top: 4mm;
  }

  #printSlip th,
  #printSlip td {
    border-bottom: 1px solid #aaa;
    padding: 3mm 0;
    text-align: left;
  }

  #printSlip.printReceipt th,
  #printSlip.printReceipt td {
    padding: 2mm 0;
    vertical-align: top;
  }

  #printSlip.printReceipt th:nth-child(2),
  #printSlip.printReceipt td:nth-child(2) {
    width: 12mm;
    text-align: right;
  }

  #printSlip.printReceipt th:nth-child(3),
  #printSlip.printReceipt td:nth-child(3) {
    width: 18mm;
    text-align: right;
  }
}
