:root {
  --bg: #111827;
  --panel: #ffffff;
  --text: #172033;
  --muted: #657186;
  --line: #d8e0ec;
  --accent: #087c7a;
  --accent-dark: #05615f;
  --danger: #9f1239;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

header {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: #0b1220;
  color: #fff;
  border-bottom: 4px solid #14b8a6;
}

h1 {
  margin: 0;
  font-size: 20px;
}

header span {
  color: #cbd5e1;
  font-size: 13px;
}

main {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 16px 32px;
}

.controls {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 180px 120px auto auto auto;
  gap: 8px;
  margin-bottom: 14px;
}

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

input {
  border: 1px solid var(--line);
  padding: 0 12px;
  outline: none;
}

select {
  border: 1px solid var(--line);
  padding: 0 12px;
  background: #fff;
  color: var(--text);
}

input:focus,
select:focus {
  border-color: var(--accent);
}

button {
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
}

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

button.secondary {
  color: #fff;
  background: var(--accent);
  border: 0;
}

.scanButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.scanIcon {
  font-size: 18px;
  line-height: 1;
}

.message,
.stockCard,
.scanner {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .24);
}

.message {
  display: none;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.message.error {
  color: var(--danger);
}

.cards {
  display: grid;
  gap: 14px;
}

.stockCard {
  overflow: hidden;
}

.cardToggle {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: start;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  text-align: left;
}

.cardToggle:hover {
  background: #f8fbff;
}

.cardTitle {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.3;
}

.cardMeta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.cardTotal {
  min-width: 94px;
  text-align: right;
}

.cardTotal span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.cardTotal strong {
  font-size: 26px;
}

.chevron {
  align-self: center;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform .15s ease;
}

.stockCard.open .chevron {
  transform: rotate(90deg);
}

.matrixWrap {
  display: none;
  overflow: auto;
}

.stockCard.open .matrixWrap {
  display: block;
}

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

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

th {
  background: #edf3f9;
  color: #334155;
  font-size: 12px;
  text-transform: uppercase;
}

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

.mobileDepot {
  display: none;
}

.qty {
  display: inline-flex;
  min-width: 34px;
  height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  background: #e9f7f4;
  color: #075e59;
  font-weight: 700;
}

.qty.empty {
  background: transparent;
  color: var(--muted);
}

.sizeCell {
  font-weight: 700;
}

.totalCell {
  font-weight: 700;
}

.scanner {
  display: none;
  padding: 10px;
  margin-bottom: 14px;
}

.scanner.active { display: block; }

video {
  width: 100%;
  max-height: 340px;
  background: #0f172a;
  object-fit: cover;
}

#reader {
  width: 100%;
  background: #0f172a;
}

#reader video {
  width: 100% !important;
  max-height: 360px;
  object-fit: cover;
}

#reader__scan_region {
  background: #0f172a;
}

#reader__dashboard_section,
#reader__dashboard_section_csr,
#reader__header_message {
  display: none !important;
}

.scannerFooter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 760px) {
  header,
  .scannerFooter {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  #searchInput,
  #depotFilter,
  #sizeFilter {
    grid-column: 1 / -1;
  }

  header {
    gap: 6px;
    padding: 8px 10px;
  }

  h1 {
    font-size: 18px;
  }

  header span {
    font-size: 12px;
  }

  main {
    padding: 10px 8px 22px;
  }

  input,
  select,
  button {
    min-height: 38px;
    font-size: 14px;
  }

  input {
    padding: 0 9px;
  }

  button {
    width: 100%;
    padding: 0 6px;
    white-space: nowrap;
  }

  .scanButton {
    gap: 4px;
  }

  .scanIcon {
    font-size: 14px;
  }

  .cardToggle {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 10px 9px;
  }

  .cardTotal {
    text-align: left;
  }

  .cardTitle {
    font-size: 14px;
    margin-bottom: 5px;
  }

  .cardMeta {
    gap: 5px;
    font-size: 11px;
  }

  .cardTotal span {
    font-size: 10px;
    margin-bottom: 2px;
  }

  .cardTotal strong {
    font-size: 20px;
  }

  .chevron {
    display: none;
  }

  table {
    width: max-content;
    min-width: 100%;
    table-layout: fixed;
  }

  th,
  td {
    padding: 7px 6px;
    font-size: 11px;
    width: 34px;
    max-width: 34px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .muted {
    font-size: 8px;
  }

  th:nth-child(2),
  td:nth-child(2) {
    width: 72px;
    max-width: 72px;
  }

  th:nth-last-child(2),
  td:nth-last-child(2) {
    width: 40px;
    max-width: 40px;
  }

  th:last-child,
  td:last-child {
    width: 45px;
    max-width: 54px;
  }

  td:last-child {
    font-size: 10px;
  }

  th {
    font-size: 10px;
  }

  .sizeHead {
    font-size: 0;
  }

  .sizeHead::after {
    content: "BDN";
    font-size: 10px;
  }

  .webDepot {
    display: none;
  }

  .mobileDepot {
    display: inline;
  }

  .stackedDepot {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    font-size: 7.5px;
    line-height: 1;
  }

  .qty {
    min-width: 0;
    height: auto;
    padding: 0;
    background: transparent;
    color: var(--text);
  }

  .message {
    padding: 14px 10px;
    font-size: 13px;
  }
}
