/* Item Intake — Tulsa Slab Co brand (cream / navy / red / gold) */
:root {
  --navy: #0a1f44;
  --navy-deep: #061428;
  --red: #9b2335;
  --gold: #c9a227;
  --cream: #f8f4eb;
  --cream-dark: #ede6d6;
  --white: #ffffff;
  --text: #0a1f44;
  --text-muted: #4a5568;
  --border: rgba(10, 31, 68, 0.14);
  --shadow: 0 12px 40px rgba(10, 31, 68, 0.12);
  --ok: #1a7f4b;
  --warn: #b45309;
  --danger: #9b2335;
  --radius: 14px;
  --tap: 48px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --app-max: 560px;
  /* Brand kit v1.1: Archivo body/UI, Archivo Narrow display (roman only). Faces load from /css/fonts.css. */
  --font-display: "Archivo Narrow", "Arial Narrow", system-ui, sans-serif;
  --font-sans: "Archivo", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100dvh; }

#app {
  max-width: var(--app-max);
  margin: 0 auto;
  padding: calc(12px + var(--safe-t)) 16px calc(24px + var(--safe-b));
}

.app-header {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.header-badge {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 8px;
}
.header-text { min-width: 0; }
.app-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--navy);
}
.subtitle {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.header-meta {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  color: var(--navy);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(10, 31, 68, 0.06);
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 18px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--cream) 92%, transparent);
  backdrop-filter: blur(8px);
  padding: 8px 0;
}

.step-tab {
  min-height: var(--tap);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-muted);
  border-radius: 999px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 2px;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(10, 31, 68, 0.04);
}
.step-tab .step-num {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--navy);
}
.step-tab .step-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}
.step-tab[aria-current="step"] {
  border-color: var(--red);
  background: var(--red);
  color: var(--white);
  box-shadow: 0 8px 20px rgba(155, 35, 53, 0.28);
}
.step-tab[aria-current="step"] .step-num,
.step-tab[aria-current="step"] .step-label { color: var(--white); }
.step-tab:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
.step-tab:not(:disabled):active { transform: scale(0.98); }

.panel h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
  color: var(--navy);
  font-weight: 800;
}
.hint {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 0.92rem;
}
.hint.tiny { font-size: 0.8rem; margin-top: 4px; }
.hint em { font-style: normal; opacity: 0.85; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.field span { font-size: 0.88rem; color: var(--text-muted); font-weight: 600; }
.field span strong { color: var(--red); font-weight: 700; }
.field.inline { flex: 1; min-width: 0; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-group {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px 4px;
  margin: 0 0 14px;
  background: var(--white);
  box-shadow: 0 2px 10px rgba(10, 31, 68, 0.04);
}
.form-group legend {
  padding: 0 6px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--navy);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--cream);
  color: var(--navy);
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
}
textarea { min-height: 72px; resize: vertical; background: var(--cream); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(155, 35, 53, 0.18);
  background: var(--white);
}
input[type="file"] {
  padding: 10px;
  font-size: 0.9rem;
  background: var(--white);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  width: 100%;
  padding: 12px 18px;
  margin: 6px 0;
  border-radius: 999px;
  border: 2px solid transparent;
  font: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn:active:not(:disabled) { transform: scale(0.985); }
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn.primary {
  background: var(--red);
  color: var(--white);
  box-shadow: 0 8px 24px rgba(155, 35, 53, 0.25);
}
.btn.primary:active:not(:disabled) { filter: brightness(0.95); }
.btn.secondary {
  background: var(--navy);
  color: var(--cream);
}
.btn.ghost {
  background: transparent;
  border-color: var(--navy);
  color: var(--navy);
  font-weight: 700;
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 12px;
}

.preview {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  background: var(--white);
  border: 1px dashed var(--gold);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 12px;
  word-break: break-all;
  color: var(--navy);
}

.error.soft {
  color: var(--danger);
  background: rgba(155, 35, 53, 0.08);
  border: 1px solid rgba(155, 35, 53, 0.2);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 12px;
  font-size: 0.9rem;
}

.locked-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  box-shadow: var(--shadow);
}

.sku-badge {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  font-weight: 800;
  background: var(--cream-dark);
  border: 1px solid var(--gold);
  color: var(--navy);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
  word-break: break-all;
}

.batch-aside {
  display: none;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.batch-aside h3 { margin: 0 0 8px; font-size: 1rem; color: var(--navy); }
.batch-aside p { margin: 0 0 10px; color: var(--text-muted); font-size: 0.92rem; }
.batch-aside code {
  background: var(--cream-dark);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--red);
}
.aside-example { color: var(--navy) !important; }
.aside-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.aside-list li { margin-bottom: 6px; }

.scanner-area {
  position: relative;
  background: var(--navy-deep);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
  aspect-ratio: 4 / 3;
}
.scanner-area video,
.scanner-area canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
#html5QrHost { min-height: 240px; }

.sku-list-panel { display: none; margin-top: 8px; }
.sku-list-title {
  margin: 0 0 8px;
  font-size: 0.78rem;
  color: var(--navy);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sku-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--white);
}
.sku-list li button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--navy);
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.sku-list li:last-child button { border-bottom: none; }
.sku-list li button:hover,
.sku-list li button.active {
  background: rgba(155, 35, 53, 0.08);
  color: var(--red);
}
.sku-list .tag {
  font-family: inherit;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.item-form-placeholder {
  display: none;
  background: var(--white);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}
.item-form-placeholder[hidden],
.item-form[hidden] { display: none !important; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 14px;
}
.photo-grid:empty { display: none; }
.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--cream-dark);
  border: 1px solid var(--border);
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-thumb button.remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(10, 31, 68, 0.75);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
}

/* —— On-screen label preview (2×1 stickers) —— */
.label-sheet {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-content: flex-start;
}
.label-preview {
  width: 2in;
  height: 1in;
  max-width: 100%;
  background: #fff;
  border: 1px solid #c8cdd6;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(10, 31, 68, 0.18);
  overflow: hidden;
  flex-shrink: 0;
}

/* Screen preview = same face box as card inventoryLabelCss / ZT410 Avery 1×2 */
/* padding 0.08in 0.21in 0.08in 0.10in · logo 0.32in · media 2in×1in */
.label-preview .tsc-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.05in;
  width: 2in;
  height: 1in;
  padding: 0.08in 0.21in 0.08in 0.10in;
  overflow: hidden;
  background: #fff;
  color: #0a1f44;
  font-family: Helvetica, Arial, sans-serif;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.label-preview .tsc-logo {
  width: 0.32in;
  height: 0.32in;
  object-fit: contain;
  flex-shrink: 0;
}
.label-preview .tsc-seq {
  flex-shrink: 0;
  min-width: 0.28in;
  font-size: 18pt;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #0a1f44;
  text-align: center;
}
.label-preview .tsc-qr-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.02in;
  min-width: 0;
  flex: 0 1 auto;
  max-width: 0.95in;
  overflow: hidden;
}
.label-preview .tsc-qr {
  width: 0.48in;
  height: 0.48in;
  flex-shrink: 0;
  object-fit: contain;
}
.label-preview .tsc-sku {
  font-size: 5.5pt;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.12;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-all;
  max-width: 100%;
  color: #0a1f44;
}
.label-preview .tsc-title {
  font-size: 6pt;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  color: #0a1f44;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 8px;
}
.meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 10px;
}

.inv-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.inv-table-wrap { display: none; }

.inv-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  width: 100%;
  box-shadow: 0 2px 8px rgba(10, 31, 68, 0.05);
}
.inv-card:active { border-color: var(--red); }
.inv-card .thumb {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--cream-dark);
  display: block;
}
.inv-card .thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.7rem;
}
.inv-card .sku {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  color: var(--red);
  margin: 0 0 2px;
  font-weight: 700;
}
.inv-card .name {
  font-weight: 700;
  margin: 0 0 2px;
  color: var(--navy);
}
.inv-card .sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 0 2px;
}
.inv-card .loc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}
.inv-card .status-pill {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  background: var(--cream-dark);
  border: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--navy);
  font-weight: 700;
}
.status-pill.sold { border-color: var(--ok); color: var(--ok); }
.status-pill.listed { border-color: var(--gold); color: var(--navy); background: rgba(201, 162, 39, 0.18); }
.status-pill.ready { border-color: var(--warn); color: var(--warn); }

.inv-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.inv-table th,
.inv-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.inv-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--cream-dark);
  font-weight: 800;
}
.inv-table tr:last-child td { border-bottom: none; }
.inv-table tr:hover td { background: rgba(155, 35, 53, 0.04); }
.inv-table .thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
  background: var(--cream-dark);
}
.inv-table .sku-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  color: var(--red);
  white-space: nowrap;
  font-weight: 700;
}
.inv-table .btn-link {
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--navy);
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 36px;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.inv-table .btn-link:hover {
  border-color: var(--red);
  color: var(--red);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 31, 68, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-b));
}
.modal[hidden] { display: none !important; }
.modal-card {
  width: 100%;
  max-width: 520px;
  max-height: 90dvh;
  overflow: auto;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 16px;
  box-shadow: var(--shadow);
}
.modal-card--wide { max-width: 720px; }
.modal-card h3 { margin: 0 0 10px; color: var(--navy); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 60;
  background: var(--navy);
  color: var(--cream);
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(10, 31, 68, 0.35);
  max-width: calc(100% - 32px);
  text-align: center;
}
.toast[hidden] { display: none !important; }

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 28px 12px;
}

.panel-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 2px 12px rgba(10, 31, 68, 0.05);
}

/* —— Tablet+ —— */
@media (min-width: 720px) {
  :root { --app-max: 960px; --tap: 44px; }

  #app { padding: 24px 28px 40px; }

  .app-header h1 { font-size: 1.65rem; }
  .header-badge { width: 52px; height: 52px; }

  .steps {
    gap: 10px;
    position: static;
    margin-bottom: 24px;
  }
  .step-tab {
    flex-direction: row;
    gap: 10px;
    padding: 10px 16px;
    min-height: 48px;
  }
  .step-tab .step-label {
    font-size: 0.82rem;
    letter-spacing: 0.04em;
  }

  .batch-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 28px;
    align-items: start;
  }
  .batch-form-col {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow);
  }
  .batch-aside { display: block; }

  .label-sheet { gap: 14px; }

  .toolbar {
    flex-direction: row;
    gap: 12px;
    align-items: stretch;
  }
  .toolbar .btn {
    width: auto;
    flex: 0 1 auto;
    min-width: 160px;
    margin: 0;
  }

  .capture-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    align-items: start;
  }
  .sku-list-panel { display: block; }
  .item-form-placeholder { display: block; }
  .capture-form-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
    align-items: start;
  }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }

  .edit-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .edit-form-grid .form-group:last-child {
    grid-column: 1 / -1;
  }

  .inv-list { display: none; }
  .inv-table-wrap { display: block; overflow-x: auto; }

  .modal { align-items: center; }
  .modal-card {
    max-width: 560px;
    border-radius: 16px;
  }
  .modal-card--wide { max-width: 780px; }

  .btn:hover:not(:disabled) {
    transform: translateY(-1px);
  }
}

/* —— Desktop / MacBook —— */
@media (min-width: 1024px) {
  :root { --app-max: 1100px; }

  #app { padding: 28px 36px 48px; }

  .steps { max-width: 720px; }

  .batch-layout {
    grid-template-columns: 1fr 360px;
    gap: 36px;
  }

  .capture-layout {
    grid-template-columns: 300px 1fr;
    gap: 28px;
  }

  .filters { max-width: 640px; }
  .filters .btn.ghost {
    width: auto;
    min-width: 120px;
    margin: 0 0 14px;
  }
}

@media print {
  body * { visibility: hidden !important; }
  #panel-2, #panel-2 * { visibility: visible !important; }
  .no-print, .toolbar, .app-header, .steps, .hint, #toast, .modal, .header-meta {
    display: none !important;
  }
}

/* Brand kit v1.1 look (Nov 24 2026, preview): cream/navy stock, red for the active step and primary action,
   gold only as a hairline, squared 3-4px corners, no tinted glow shadows. Type is unchanged. */
:root { --radius: 4px; --shadow: none; --border: rgba(10, 31, 68, 0.2); }
.app-header { padding-bottom: 12px; border-bottom: 1px solid var(--gold); }
.header-meta, .step-tab, .form-group, input[type="text"], input[type="number"], input[type="date"], input[type="file"], select, textarea { border-radius: 3px; box-shadow: none; }
.steps { background: var(--cream); backdrop-filter: none; }
.step-tab { background: var(--cream); }
.step-tab[aria-current="step"] { box-shadow: none; }
.step-tab:disabled { opacity: 1; border-style: dashed; cursor: not-allowed; }
.step-tab:disabled, .step-tab:disabled .step-label, .step-tab:disabled .step-num { color: var(--text-muted, #4A5568); }
.step-tab:disabled .step-num { background: var(--cream-dark); }
.form-group, .header-meta { background: var(--cream); }
.btn { border-radius: 3px; box-shadow: none; }
.btn.primary { box-shadow: none; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .step-tab:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.status-pill { border-radius: 2px; }
.status-pill.listed { background: var(--cream-dark); }
