/* BetaWave Inventory app: Operate surface. The world lends type, palette, density, and the bin-position sheet map. */

.bar {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px;
  min-height: 64px; padding: 10px 20px;
  background: var(--yellow);
  border-bottom: 3px solid var(--ink);
}
.brand {
  font-family: var(--display); font-weight: 900; font-size: 30px; letter-spacing: 0.02em; line-height: 1;
  text-decoration: none;
}
.bar-mid { display: flex; justify-content: flex-start; }
.bar-field { display: flex; align-items: center; gap: 10px; font-weight: 650; color: var(--on-yellow-2); }
.bar-field select { min-width: 200px; }
.bar-end { display: flex; align-items: center; gap: 16px; }
.bar-link { font-weight: 650; color: var(--on-yellow-2); white-space: nowrap; }
.bar-count { margin: 0; font-weight: 650; color: var(--on-yellow-2); white-space: nowrap; }
.bar-count strong { color: var(--ink); }

select, input[type="text"], input[type="number"], input[type="search"], textarea {
  min-height: 38px; padding: 6px 10px;
  border: 1.5px solid var(--line); border-radius: var(--radius);
  background: var(--paper);
}
select:hover, input:hover, textarea:hover { border-color: #8d9297; }
.bar select { border-color: var(--ink); }

.work {
  display: grid;
  grid-template-columns: minmax(480px, 1.4fr) minmax(360px, 1fr) minmax(250px, 290px);
  gap: 16px; padding: 16px 20px 40px;
  align-items: start;
}
.panel {
  background: var(--paper);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(17, 17, 17, 0.08), 0 4px 14px rgba(17, 17, 17, 0.05);
  padding: 18px 20px 20px;
  min-width: 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel h2 {
  margin: 0; font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1; letter-spacing: 0.01em; text-transform: uppercase;
}
.panel-actions { display: flex; gap: 8px; align-items: center; }
.muted { color: #5b6066; margin: 0; font-size: 14px; }
.hint { color: #5b6066; font-size: 13.5px; margin: 6px 0 0; }

/* Import */
.import-h { margin: 6px 0 4px; font-size: 18px; }
.import-sub { margin: 0 0 12px; color: var(--ink-2); max-width: 62ch; }
#paste {
  width: 100%; min-height: 168px; resize: vertical;
  font-family: var(--mono); font-size: 13px; line-height: 1.5;
  background: repeating-linear-gradient(transparent 0 19.5px, #eef0f1 19.5px 20px) local, var(--paper);
  padding: 10px 12px;
}
.import-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.import-actions .btn[for] { cursor: pointer; }
.import-error { margin: 10px 0 0; color: var(--danger); font-weight: 600; }
.import-soon { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--concrete); color: #5b6066; font-size: 13.5px; }

/* Search */
.search { position: relative; display: block; }
.search svg { position: absolute; left: 10px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: #5b6066; }
.search input { padding-left: 32px; width: 220px; }

/* Mapping */
.mapping { margin-bottom: 12px; border: 1.5px solid var(--concrete); border-radius: var(--radius); }
.mapping summary { cursor: pointer; padding: 8px 12px; font-weight: 650; }
.mapping[open] summary { border-bottom: 1.5px solid var(--concrete); }
.mapping-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 14px; padding: 12px; }
.mapping-grid label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }

.warn {
  display: flex; gap: 10px; align-items: flex-start;
  margin-bottom: 12px; padding: 10px 12px;
  background: var(--danger-soft); color: #6d0a1a; border-radius: var(--radius);
}
.warn svg { flex: none; width: 20px; height: 20px; margin-top: 1px; color: var(--danger); }
.warn p { margin: 0; }

/* Table */
.table-wrap { max-height: calc(100vh - 300px); min-height: 200px; overflow: auto; border: 1.5px solid var(--concrete); border-radius: var(--radius); }
.items-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.items-table th {
  position: sticky; top: 0; z-index: 1;
  background: #f6f6f7; text-align: left; font-size: 12.5px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: #4c5157;
  padding: 8px 10px; border-bottom: 1.5px solid var(--concrete);
}
.items-table td { padding: 6px 10px; border-bottom: 1px solid #eff0f1; vertical-align: middle; }
.items-table tr { cursor: pointer; }
.items-table tbody tr:hover td { background: #fafafa; }
.items-table tr.is-active td { background: var(--yellow-soft); }
.items-table tr.is-zero td:not(:last-child) { color: #8a8f95; }
.items-table .r { text-align: right; }
.items-table td.name { min-width: 140px; font-weight: 550; line-height: 1.3; overflow-wrap: anywhere; }
.items-table td.mono { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.items-table th:last-child, .items-table td:last-child { width: 1%; padding-right: 8px; position: sticky; right: 0; background: #fff; box-shadow: -8px 0 8px -8px rgba(0,0,0,.18); }
.items-table th:last-child { background: #f6f6f7; z-index: 2; }
.items-table tr.is-active td:last-child { background: var(--yellow-soft); }
.code-bad { color: var(--danger); font-weight: 650; display: inline-flex; gap: 4px; align-items: center; }
.code-bad svg { width: 14px; height: 14px; }
.qty { width: 72px; text-align: right; font-variant-numeric: tabular-nums; min-height: 32px; padding: 4px 8px; }
.empty { padding: 24px; text-align: center; color: #5b6066; margin: 0; }
.table-foot { display: flex; gap: 4px; margin-top: 8px; }

/* Preview */
.preview-stage {
  display: grid; place-items: center;
  min-height: 220px; padding: 28px 16px;
  background: var(--concrete);
  border-radius: 8px;
  overflow: hidden;
}
.preview-scale { transform-origin: center; }
.preview-scale .lbl {
  border-radius: 0.06in;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12), 0 6px 18px rgba(0, 0, 0, 0.14);
}

/* Design */
.design { margin-top: 18px; display: grid; gap: 18px; }
.field { display: grid; gap: 4px; font-weight: 650; font-size: 14px; }
.field select { width: 100%; }
.rows-editor { border: 0; padding: 0; margin: 0; }
.rows-editor legend { font-weight: 650; font-size: 14px; padding: 0; margin-bottom: 6px; }
.row-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row-item {
  display: grid; gap: 8px;
  grid-template-columns: 1fr auto;
  padding: 10px; border: 1.5px solid var(--concrete); border-radius: var(--radius);
}
.row-item.is-code { border-color: var(--yellow-deep); background: #fffcef; }
.row-main { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-main select { min-width: 0; }
.row-main .kind { font-size: 12px; font-weight: 750; letter-spacing: 0.05em; text-transform: uppercase; color: #5b6066; width: 100%; }
.row-main input.size { width: 64px; }
.row-main input.fixed { flex: 1 1 140px; }
.row-tools { display: flex; flex-direction: column; gap: 2px; }
.icon-btn {
  display: grid; place-items: center; width: 30px; height: 28px;
  border: 0; border-radius: 4px; background: transparent; cursor: pointer; color: #4c5157;
}
.icon-btn:hover { background: var(--concrete); color: var(--ink); }
.icon-btn[disabled] { opacity: 0.3; cursor: default; background: transparent; }
.icon-btn svg { width: 16px; height: 16px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; }
.row-add { display: flex; gap: 8px; margin-top: 10px; }

.save-tpl { padding-top: 16px; border-top: 1px solid var(--concrete); }
.save-row { display: flex; gap: 8px; font-weight: 400; }
.save-row input { flex: 1; min-width: 0; }

/* Sheet map: positions named like bin locations */
.sheet-map {
  --cols: 3;
  display: grid; grid-template-columns: repeat(var(--cols), 1fr);
  gap: 3px; padding: 10px;
  margin-top: 10px;
  background: var(--paper);
  border: 1.5px solid var(--line); border-radius: 4px;
  aspect-ratio: 8.5 / 11;
}
.cell {
  display: grid; place-items: center;
  min-width: 0; padding: 0;
  font: 700 11px/1 var(--display); letter-spacing: 0.04em;
  border: 1px solid var(--line); border-radius: 2px;
  background: #fff; color: var(--ink-2); cursor: pointer;
}
.cell:hover { border-color: var(--ink); color: var(--ink); }
.cell.is-skip { background: repeating-linear-gradient(-45deg, #f1f2f3 0 3px, #e1e3e5 3px 6px); color: var(--ink-2); }
.cell.is-fill { background: var(--yellow); border-color: var(--yellow-deep); color: var(--ink); }
.cell.is-start { outline: 2px solid var(--ink); outline-offset: 1px; z-index: 1; }
.sheet-map.dense .cell { font-size: 0; }
.start-line { margin: 8px 0 0; font-size: 14px; }
.start-line button { margin-left: 6px; }
.check { display: flex; gap: 8px; align-items: flex-start; margin-top: 16px; font-size: 14px; }
.check input { margin-top: 3px; accent-color: var(--ink); width: 16px; height: 16px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  padding: 10px 16px; border-radius: var(--radius);
  background: var(--ink); color: var(--yellow); font-weight: 650;
  opacity: 0; transition: opacity 200ms, transform 300ms var(--ease-out);
  pointer-events: none;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* Responsive */
@media (max-width: 1240px) {
  .work { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .items { grid-column: 1 / -1; }
  .table-wrap { max-height: 420px; }
}
@media (max-width: 760px) {
  .bar { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 10px 14px; }
  .bar-mid { grid-column: 1 / -1; grid-row: 2; min-width: 0; }
  .bar-field select { min-width: 0; width: 100%; flex: 1; }
  .bar-field { width: 100%; min-width: 0; }
  .bar-count { display: none; }
  .work { grid-template-columns: 1fr; padding: 12px; }
  .search input { width: 160px; }
}

@media (max-width: 520px) {
  .bar { grid-template-columns: minmax(0, 1fr); }
  .bar-end { grid-row: 2; justify-content: space-between; }
  .bar-mid { grid-row: 3; }
}

@media (max-width: 420px) {
  .brand { font-size: 18px; white-space: nowrap; }
}

.brand { display: inline-flex; align-items: center; }
.brand-mark { width: 0.86em; height: 0.86em; flex: none; margin-right: 0.32em; }
