/* v1.3.3: Kho vật tư — nút KHO dưới RW + bảng tra cứu tồn kho */
.map-type-button.type-kho.is-on {
  border-color: #fcd34d;
  color: #92400e;
}
.map-type-button.type-kho[aria-expanded="true"] {
  border-color: #d97706;
  color: #fff;
  background: #d97706;
  box-shadow: 0 8px 22px rgba(217, 119, 6, 0.42);
}

.inv-panel {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  justify-content: flex-end;
  background: rgba(7, 17, 31, 0.35);
}
.inv-panel[hidden] { display: none; }
.inv-sheet {
  display: flex;
  flex-direction: column;
  width: min(460px, 100%);
  height: 100%;
  background: var(--surface, #fff);
  color: var(--ink-900, #0f172a);
  box-shadow: var(--shadow-lg, 0 24px 70px rgba(2, 8, 23, 0.22));
  padding-top: env(safe-area-inset-top, 0px);
}
.inv-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 10px;
}
.inv-header h2 { margin: 2px 0 4px; font-size: 20px; line-height: 1.2; }
.inv-header small { color: var(--ink-500, #64748b); font-size: 12px; }
.inv-header .eyebrow { margin: 0; color: #b45309; }
.inv-close {
  flex: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: var(--surface-muted, #f8fafc);
  color: var(--ink-700, #334155);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.inv-tabs {
  display: flex;
  gap: 4px;
  margin: 0 16px;
  padding: 4px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: var(--surface-muted, #f8fafc);
}
.inv-tabs button {
  flex: 1;
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--ink-500, #64748b);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}
.inv-tabs button[aria-selected="true"] { background: #d97706; color: #fff; }
.inv-tools { display: flex; gap: 8px; padding: 10px 16px; }
.inv-tools input {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  background: var(--surface-muted, #f8fafc);
  color: inherit;
  font-family: inherit;
  font-size: 15px;
}
.inv-tools input:focus { outline: 2px solid #f59e0b; outline-offset: 1px; }
.inv-chip {
  flex: none;
  padding: 0 12px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 999px;
  background: var(--surface, #fff);
  color: var(--ink-600, #475569);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.inv-chip[aria-pressed="true"] { border-color: #16a34a; background: #dcfce7; color: #15803d; }
.inv-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px));
}
.inv-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 2px 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fffbeb;
  color: #78350f;
  font-size: 13px;
}
.inv-summary .bad { color: #b91c1c; }
.inv-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.inv-row {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: var(--surface, #fff);
  padding: 10px 12px;
}
.inv-row:has(> .inv-toggle) { padding: 0; }
.inv-toggle {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.inv-mat.open { border-color: #f59e0b; box-shadow: 0 4px 14px rgba(217, 119, 6, 0.12); }
.inv-name { font-size: 14px; font-weight: 800; line-height: 1.3; }
.inv-name em { color: #b45309; font-style: normal; font-weight: 700; }
.inv-sub {
  margin-top: 2px;
  color: var(--ink-500, #64748b);
  font: 12px/1.35 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}
.inv-note { font-family: inherit; color: #b45309; }
.inv-total { margin-top: 6px; color: var(--ink-600, #475569); font-size: 12px; }
.inv-total b { color: #15803d; font-variant-numeric: tabular-nums; }
.inv-qs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.inv-q {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.inv-q b { font-weight: 900; }
.inv-q.good { background: #dcfce7; color: #166534; }
.inv-q.good.zero { background: var(--ink-100, #f1f5f9); color: var(--ink-500, #64748b); }
.inv-q.bad { background: #fee2e2; color: #b91c1c; }
.inv-q.transit { background: #e0f2fe; color: #0369a1; }
.inv-holders { list-style: none; margin: 0; padding: 0 12px 10px; display: grid; gap: 6px; }
.inv-holders li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-muted, #f8fafc);
}
.inv-holders li .inv-qs { margin-top: 0; }
.inv-holders li.is-main { background: #fffbeb; }
.inv-holders li.is-me { outline: 2px solid #f59e0b; }
.inv-who { font-size: 13px; font-weight: 700; }
.inv-who small, .inv-h small { color: var(--ink-500, #64748b); font-weight: 600; font-size: 11px; }
.inv-who em { color: #b45309; font-style: normal; }
.inv-back {
  margin: 0 0 6px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: #b45309;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.inv-h { margin: 0 0 10px; font-size: 17px; }
.inv-empty { margin: 18px 4px; color: var(--ink-500, #64748b); font-size: 14px; text-align: center; }
body.inv-open { overflow: hidden; }

.upload-card-inventory .upload-step { background: #d97706; }

@media (max-width: 760px) {
  .inv-sheet { width: 100%; }
}
