:root {
  color-scheme: dark;
  --bg: #070807;
  --surface: #111311;
  --surface-alt: #181b18;
  --surface-raised: #20231f;
  --ink: #f5f2ea;
  --muted: #a4aaa2;
  --line: #2b302b;
  --accent: #c7a365;
  --accent-strong: #e1be7d;
  --teal: #58c1b4;
  --amber: #d0a24f;
  --red: #e46c61;
  --blue: #83b7e2;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at top left, rgba(199, 163, 101, 0.13), transparent 30%),
    #050605;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-brand {
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
}

.login-hint {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #050605;
  color: var(--ink);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-right: 1px solid #1f241f;
}

.brand-block {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #080907;
  border-radius: var(--radius);
  font-weight: 800;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.brand-block strong,
.brand-block span {
  display: block;
}

.brand-block span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  border: 0;
  background: transparent;
  color: #d9ddd6;
  text-align: left;
  padding: 11px 12px;
  border-radius: var(--radius);
}

.nav-item:hover,
.nav-item.active {
  background: #1b1d19;
  color: #ffffff;
  box-shadow: 0 0 0 1px #2b312b inset;
}

.side-note {
  margin-top: auto;
  background: #111411;
  border: 1px solid #2d342d;
  padding: 14px;
  border-radius: var(--radius);
}

.side-note span,
.side-note p {
  color: var(--muted);
  font-size: 13px;
}

.side-note strong {
  display: block;
  margin: 3px 0 6px;
}

.side-note p {
  margin: 0;
  line-height: 1.45;
}

.main-area {
  padding: 22px;
  overflow: min(100vh, 100dvh) auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.topbar h1 {
  font-size: 28px;
  margin: 0 0 4px;
  letter-spacing: 0;
  color: #fffaf0;
}

.topbar p {
  margin: 0;
  color: var(--muted);
}

.topbar-actions,
.button-row,
.inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #080907;
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--radius);
  font-weight: 700;
}

.button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.button.secondary {
  color: var(--ink);
  background: #171a17;
  border-color: var(--line);
}

.button.secondary:hover {
  border-color: var(--accent);
  background: #21251f;
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.register-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.register-tools {
  justify-content: flex-end;
}

.compact-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.checking-defect-wrap {
  max-height: 300px;
}

.defect-qty-input {
  width: 88px;
  min-height: 30px;
  padding: 5px 8px;
  text-align: right;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.panel,
.metric,
.backup-alert {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
  margin-bottom: 18px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    var(--shadow);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading h2 {
  font-size: 17px;
  margin: 0;
  letter-spacing: 0;
  color: #fffaf0;
}

.panel-heading span {
  color: var(--muted);
  font-size: 13px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  padding: 16px;
  min-height: 112px;
  background: #111411;
}

.metric span,
.metric small {
  color: var(--muted);
}

.metric strong {
  display: block;
  font-size: 30px;
  margin: 7px 0 3px;
  color: #fffaf0;
}

.metric.warning {
  border-left: 4px solid var(--accent);
}

.two-column,
.split-layout,
.report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.settings-layout {
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
}

.locations-layout {
  grid-template-columns: minmax(280px, 0.45fr) minmax(0, 1fr);
}

.labels-layout {
  grid-template-columns: minmax(320px, 0.55fr) minmax(0, 1fr);
}

.fabric-entry-layout,
.fabric-summary-layout,
.fabric-code-layout,
.cutting-entry-layout,
.checking-entry-layout {
  margin-bottom: 18px;
}

.panel-stack {
  display: grid;
  gap: 18px;
}

.checking-form-stack .form-panel {
  position: static;
}

.sku-only-panel {
  margin: 18px 0;
}

.form-panel {
  position: sticky;
  top: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.field,
.check-field {
  display: grid;
  gap: 6px;
}

.field.full,
.check-field.full {
  grid-column: 1 / -1;
}

.field span,
.check-field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.search-input,
.date-filter {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--ink);
  min-height: 38px;
  padding: 8px 10px;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-input:focus,
.date-filter:focus {
  outline: 2px solid rgba(199, 163, 101, 0.22);
  border-color: var(--accent);
}

.date-filter {
  min-width: 138px;
}

.field.compact {
  min-width: 180px;
}

.check-field {
  grid-template-columns: 18px 1fr;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  border-radius: var(--radius);
}

.check-field input {
  width: 16px;
  height: 16px;
}

.dispatch-availability {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.availability-tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-alt);
  padding: 10px;
}

.availability-tile span,
.availability-tile strong {
  display: block;
}

.availability-tile span {
  color: var(--muted);
  font-size: 12px;
}

.availability-tile strong {
  color: #fffaf0;
  font-size: 18px;
  margin-top: 4px;
}

.row-action {
  border: 1px solid var(--line);
  background: #171a17;
  color: var(--ink);
  min-height: 30px;
  padding: 0 9px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 800;
}

.row-action:hover {
  border-color: var(--red);
  color: var(--red);
}

.table-wrap,
.permission-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

table.compact-table {
  min-width: 0;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  background: #191d19;
  color: #c3c9c0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #151815;
}

.numeric {
  text-align: right;
}

.status-pill,
.permission-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(88, 193, 180, 0.13);
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

.status-pill.warning {
  background: rgba(208, 162, 79, 0.16);
  color: #f0c777;
}

.status-pill.blue {
  background: rgba(131, 183, 226, 0.14);
  color: var(--blue);
}

.status-pill.red {
  background: rgba(228, 108, 97, 0.14);
  color: var(--red);
}

.cloud-status-card {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.cloud-status-card strong,
.cloud-status-card p {
  display: block;
  margin: 0;
}

.cloud-status-card p {
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.45;
}

.connection-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(208, 162, 79, 0.14);
}

.connection-dot.connected {
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(88, 193, 180, 0.14);
}

.connection-dot.error {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(228, 108, 97, 0.14);
}

.muted {
  color: var(--muted);
  line-height: 1.5;
}

.import-format {
  padding: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
}

.result-box,
.backup-alert {
  padding: 12px;
}

.result-box {
  border: 1px solid var(--line);
  background: var(--surface-alt);
  border-radius: var(--radius);
  margin-top: 12px;
}

.hidden {
  display: none !important;
}

.backup-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-left: 4px solid var(--accent);
  margin-bottom: 18px;
}

.prototype-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  margin-bottom: 18px;
  background: #111411;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.prototype-banner strong,
.prototype-banner span {
  display: block;
}

.prototype-banner span {
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.45;
}

.backup-alert span {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.location-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.location-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-alt);
  padding: 12px;
}

.location-card strong,
.location-card span {
  display: block;
}

.location-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px;
  background: var(--surface-alt);
}

.timeline-item strong,
.timeline-item span {
  display: block;
}

.timeline-item span {
  color: var(--muted);
  margin-top: 3px;
  font-size: 13px;
}

.test-data-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.test-data-stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-alt);
  padding: 10px;
}

.test-data-stat span,
.test-data-stat strong {
  display: block;
}

.test-data-stat span {
  color: var(--muted);
  font-size: 12px;
}

.test-data-stat strong {
  color: #fffaf0;
  margin-top: 4px;
  font-size: 20px;
}

.label-count-panel {
  padding: 10px 12px;
  margin-bottom: 12px;
}

.label-count-panel .panel-heading {
  margin-bottom: 8px;
}

.label-count-panel .panel-heading h2 {
  font-size: 16px;
}

.label-count-panel .label-count-tools {
  margin: 0;
}

.label-count-panel .label-count-tools .field {
  width: 180px;
}

.label-count-panel .field span {
  font-size: 11px;
}

.label-count-panel .field input {
  min-height: 32px;
  padding: 6px 9px;
}

.label-daily-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 0;
}

.label-daily-stats .test-data-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 7px 9px;
}

.label-daily-stats .test-data-stat span,
.label-daily-stats .test-data-stat strong {
  margin: 0;
}

.label-daily-stats .test-data-stat span {
  font-size: 11px;
  line-height: 1.1;
}

.label-daily-stats .test-data-stat strong {
  font-size: 18px;
  line-height: 1;
}

.label-stage {
  min-height: 430px;
  display: grid;
  place-items: start center;
  background: #0d0f0d;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}

.label-preview {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.fabric-label-stage {
  min-height: 230px;
}

#fabricCodeDetails {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 10px;
  word-break: break-word;
}

#fabricCodeDetails strong {
  color: var(--ink);
}

#fabricRegisterDetails {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.detail-tile {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.detail-tile span,
.detail-tile strong {
  display: block;
}

.detail-tile span {
  color: var(--muted);
  font-size: 11px;
}

.detail-tile strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.25;
  word-break: break-word;
}

.report-print-area {
  display: none;
}

.label-count-tools {
  display: flex;
  justify-content: flex-start;
  margin: 0 0 12px;
}

.label-count-tools .field {
  width: min(220px, 100%);
}

.label-sheet-summary {
  display: grid;
  gap: 8px;
  align-self: start;
  grid-column: 1 / -1;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-alt);
  max-height: 160px;
  overflow: hidden;
}

.label-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.label-sheet-head span {
  color: var(--muted);
  font-size: 12px;
}

.label-sheet-summary .table-wrap {
  max-height: 92px;
  overflow: auto;
}

.label-sheet-summary .compact-table th,
.label-sheet-summary .compact-table td {
  padding: 5px 6px;
  font-size: 11px;
}

.label-sheet-summary .compact-table th:nth-child(3),
.label-sheet-summary .compact-table td:nth-child(3) {
  display: none;
}

.label-sheet-summary .status-pill {
  padding: 3px 6px;
  font-size: 10px;
}

.label-sheet-summary .row-action {
  padding: 0;
  font-size: 11px;
}

.label-sheet-summary.is-empty {
  max-height: 96px;
}

.label-sheet-summary.is-empty .table-wrap {
  max-height: 42px;
}

.label-sheet-summary.is-empty thead {
  display: none;
}

.label-sheet-summary.is-empty td {
  padding: 7px 6px;
  font-size: 11px;
  line-height: 1.25;
}

.label-print-area {
  display: grid;
  gap: 10px;
  justify-items: start;
  align-content: start;
  color: #111;
  --label-width: 50mm;
  --label-height: 25mm;
  --label-page-width: 102mm;
  --label-page-height: 25mm;
  --label-grid-columns: 50mm 50mm;
  --label-column-gap: 2mm;
  --barcode-height: 7.8mm;
  --barcode-width: 32mm;
  --label-top-height: 3.2mm;
  --label-media-height: 13mm;
  --label-media-gap: 1mm;
  --qr-size: 13mm;
  --label-padding: 2mm;
  --label-code-size: 7px;
  --label-detail-size: 6.2px;
}

.label-print-row,
.label-row {
  width: var(--label-page-width);
  height: var(--label-page-height);
  display: grid;
  grid-template-columns: var(--label-grid-columns);
  column-gap: var(--label-column-gap);
  align-items: start;
  justify-content: start;
  background: #fff;
}

.label-card,
.label {
  width: var(--label-width);
  height: var(--label-height);
  box-sizing: border-box;
  background: #fff;
  color: #111;
  border: 1px dashed #d2d6d6;
  padding: var(--label-padding);
  display: grid;
  grid-template-rows: minmax(0, var(--label-top-height)) minmax(0, var(--label-media-height)) minmax(0, 1fr);
  gap: 0.4mm;
  overflow: hidden;
}

.label-blank {
  border-color: transparent;
}

.label-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.label-brand {
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1;
}

.label-line {
  font-size: var(--label-detail-size);
  line-height: 1.08;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.label-code {
  font-size: var(--label-code-size);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
}

.label-sku-row {
  min-width: 0;
  align-self: center;
  font-size: var(--label-code-size);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.label-media {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--qr-size) minmax(0, var(--barcode-width));
  gap: var(--label-media-gap);
  align-items: center;
  justify-content: start;
}

.code-visual {
  height: var(--barcode-height);
  width: min(100%, var(--barcode-width));
  justify-self: center;
  align-self: center;
  display: block;
  overflow: hidden;
}

.barcode-svg {
  display: block;
  width: 100%;
  height: 100%;
  shape-rendering: crispEdges;
}

.label-bottom {
  min-height: 0;
  display: grid;
  grid-template-columns: var(--qr-size) minmax(0, 1fr);
  gap: 1.1mm;
  align-items: center;
}

.qr-visual {
  width: var(--qr-size);
  height: var(--qr-size);
  aspect-ratio: 1 / 1;
  justify-self: center;
  align-self: center;
}

.qr-svg {
  display: block;
  width: 100%;
  height: 100%;
  shape-rendering: crispEdges;
}

.qr-image {
  object-fit: contain;
  background: #fff;
  image-rendering: crisp-edges;
}

.label-text {
  min-width: 0;
  min-height: 0;
  display: grid;
  align-content: center;
  gap: 0.55mm;
}

.label-footer {
  min-width: 0;
  align-self: center;
  font-size: var(--label-detail-size);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.label-footer span + span::before {
  content: " | ";
}

.label-template-50x38-2up .label-card {
  grid-template-columns: var(--qr-size) minmax(0, 1fr);
  grid-template-rows: minmax(0, var(--label-top-height)) minmax(0, var(--barcode-height)) minmax(0, 1fr);
  grid-template-areas:
    "sku sku"
    "barcode barcode"
    "qr details";
  gap: 1mm;
}

.label-template-50x38-2up .label-sku-row {
  grid-area: sku;
}

.label-template-50x38-2up .label-media {
  display: contents;
}

.label-template-50x38-2up .code-visual {
  grid-area: barcode;
  width: min(100%, var(--barcode-width));
  height: var(--barcode-height);
  justify-self: center;
  align-self: center;
}

.label-template-50x38-2up .qr-visual {
  grid-area: qr;
  width: var(--qr-size);
  height: var(--qr-size);
}

.label-template-50x38-2up .label-footer {
  grid-area: details;
  display: grid;
  align-content: center;
  gap: 0.45mm;
  text-align: left;
  line-height: 1.05;
}

.label-template-50x38-2up .label-footer span {
  display: block;
}

.label-template-50x38-2up .label-footer span + span::before {
  content: "";
}

.qr-detail-panel {
  max-width: 860px;
  margin: 0 auto;
}

.qr-detail-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.qr-detail-hero h2 {
  margin: 4px 0;
  font-size: 24px;
}

.qr-detail-hero span,
.qr-detail-hero p {
  color: var(--muted);
  margin: 0;
}

.qr-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.qr-detail-tile {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #101210;
}

.qr-detail-tile span {
  color: var(--muted);
  font-size: 12px;
}

.qr-detail-tile strong {
  color: #fffaf0;
  word-break: break-word;
}

.qr-detail-table {
  margin-top: 18px;
}

.qr-detail-table h3 {
  margin: 0 0 10px;
}

body.qr-detail-mode .login-screen,
body.qr-detail-mode .sidebar,
body.qr-detail-mode .topbar,
body.qr-detail-mode .backup-alert,
body.qr-detail-mode .prototype-banner {
  display: none !important;
}

body.qr-detail-mode .app-shell {
  grid-template-columns: 1fr;
}

body.qr-detail-mode .main-area {
  padding: 28px;
}

.permission-table {
  min-width: 980px;
}

.permission-table th:first-child,
.permission-table td:first-child {
  position: sticky;
  left: 0;
  background: #191d19;
  z-index: 1;
}

.permission-toggle {
  display: grid;
  place-items: center;
}

.permission-toggle input {
  width: 16px;
  height: 16px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  background: #1d211d;
  color: #fff;
  padding: 12px 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: 180ms ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 220px 1fr;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .two-column,
  .split-layout,
  .report-grid,
  .settings-layout,
  .locations-layout,
  .labels-layout {
    grid-template-columns: 1fr;
  }

  .form-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main-area {
    padding: 16px;
  }

  .topbar {
    display: grid;
  }

  .metrics-grid,
  .form-grid,
  .qr-detail-grid,
  .dispatch-availability {
    grid-template-columns: 1fr;
  }

  .label-daily-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field.full,
  .check-field.full {
    grid-column: auto;
  }
}

@page {
  size: 102mm 25mm;
  margin: 0;
}

@media print {
  body.print-label *,
  body.print-label *::before,
  body.print-label *::after {
    box-sizing: border-box;
  }

  body.print-label {
    background: #fff;
  }

  body.print-label .sidebar,
  body.print-label .topbar,
  body.print-label .backup-alert,
  body.print-label .prototype-banner,
  body.print-label .screen:not(#labels),
  body.print-label #labels .form-panel,
  body.print-label .toast {
    display: none !important;
  }

  body.print-label .app-shell,
  body.print-label .main-area,
  body.print-label #labels,
  body.print-label .labels-layout,
  body.print-label .label-stage,
  body.print-label .label-preview {
    display: block;
    min-height: 0;
    padding: 0;
    margin: 0;
    border: 0;
    box-shadow: none;
    background: #fff;
  }

  body.print-label .panel:not(.label-stage) {
    display: none !important;
  }

  body.print-label .label-print-area {
    display: block;
    width: var(--label-page-width);
    background: #fff;
    color: #111;
    padding: 0;
    margin: 0;
  }

  body.print-label .label-print-row,
  body.print-label .label-row {
    display: grid;
    grid-template-columns: var(--label-grid-columns);
    column-gap: var(--label-column-gap);
    width: var(--label-page-width);
    height: var(--label-page-height);
    break-after: page;
    page-break-after: always;
    page-break-inside: avoid;
  }

  body.print-label .label-card,
  body.print-label .label {
    border: 0;
    width: var(--label-width);
    height: var(--label-height);
    padding: var(--label-padding);
    overflow: hidden;
    page-break-inside: avoid;
  }

  body.print-label .label-blank {
    visibility: hidden;
  }

  body.print-fabric *,
  body.print-fabric *::before,
  body.print-fabric *::after {
    box-sizing: border-box;
  }

  body.print-fabric {
    background: #fff;
  }

  body.print-fabric .sidebar,
  body.print-fabric .topbar,
  body.print-fabric .backup-alert,
  body.print-fabric .prototype-banner,
  body.print-fabric .screen:not(#fabric),
  body.print-fabric #fabric > :not(.fabric-code-layout),
  body.print-fabric .fabric-code-layout > .form-panel,
  body.print-fabric .toast {
    display: none !important;
  }

  body.print-fabric .app-shell,
  body.print-fabric .main-area,
  body.print-fabric #fabric,
  body.print-fabric .fabric-code-layout,
  body.print-fabric .fabric-label-stage,
  body.print-fabric .label-preview {
    display: block;
    min-height: 0;
    padding: 0;
    margin: 0;
    border: 0;
    box-shadow: none;
    background: #fff;
  }

  body.print-fabric .label-print-area {
    display: block;
    width: var(--label-page-width);
    background: #fff;
    color: #111;
    padding: 0;
    margin: 0;
  }

  body.print-fabric .label-print-row,
  body.print-fabric .label-row {
    display: grid;
    grid-template-columns: var(--label-grid-columns);
    column-gap: var(--label-column-gap);
    width: var(--label-page-width);
    height: var(--label-page-height);
    break-after: page;
    page-break-after: always;
    page-break-inside: avoid;
  }

  body.print-fabric .label-card,
  body.print-fabric .label {
    border: 0;
    width: var(--label-width);
    height: var(--label-height);
    padding: var(--label-padding);
    overflow: hidden;
    page-break-inside: avoid;
  }

  body.print-fabric .label-blank {
    visibility: hidden;
  }

  body.print-report > *:not(.report-print-area) {
    display: none !important;
  }

  body.print-report .report-print-area {
    display: block;
    color: #111;
    background: #fff;
    padding: 10mm;
    font-family: Arial, sans-serif;
  }

  body.print-report .report-print-area h1 {
    margin: 0 0 4mm;
    font-size: 18px;
  }

  body.print-report .report-print-area p {
    margin: 0 0 5mm;
    font-size: 11px;
  }

  body.print-report .report-print-area table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
  }

  body.print-report .report-print-area th,
  body.print-report .report-print-area td {
    border: 1px solid #777;
    padding: 3px 4px;
    text-align: left;
    vertical-align: top;
  }

  body.print-report .report-print-area th {
    background: #e7edf5;
    font-weight: 700;
  }
}
