/*
 * KOrder styles · public/css/09-inventory.css
 * Inventory (office/HQ and hub wastage/receiving entry).
 *
 * public/css/*.css used to be one public/styles.css. The files are cut from it in order
 * and index.html loads them in that same order, which is the CSS cascade order: do not
 * reorder the <link> tags, and add a rule to the file that owns its screen.
 * Map: public/css/README.md
 */
/* ===== Inventory (재고관리) — office/HQ ===== */
.inv-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.inv-head-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.inv-subnav {
  margin: 4px 0 14px;
}
.inv-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.inv-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.inv-search .field {
  min-width: 200px;
}
/* (2026-11-17) The search form took the width of one 100%-wide control, so the
   button (recipes) or select / button (stock) dropped to the next line. The form
   now fills the toolbar and its controls size themselves in one row. */
.inv-search {
  flex: 1 1 auto;
}
.inv-search .field {
  width: auto;
  flex: 1 1 200px;
  max-width: 360px;
}
.inv-search .select {
  width: auto;
  flex: 0 1 200px;
}
.inv-check {
  white-space: nowrap;
}
.inv-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  min-width: 620px;
}
.inv-table th,
.inv-table td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.inv-table thead th {
  background: var(--surface-strong);
  font-weight: 600;
  color: var(--muted);
  position: sticky;
  top: 0;
  z-index: 1;
}
.inv-table tbody tr:last-child td {
  border-bottom: 0;
}
.inv-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.inv-unit {
  color: var(--muted);
  font-size: 0.82em;
}
/* On hand in the extra units, under the base number: "= 120 g". */
.inv-alt-stock {
  display: block;
  color: var(--muted);
  font-size: 0.78em;
  font-weight: 600;
}
/* Ingredient form: extra units ("10 g = 1 pcs"). */
.inv-alt-units {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.inv-form label.inv-alt-toggle {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  color: inherit;
  font-weight: 700;
}
.inv-alt-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.inv-alt-body[hidden] {
  display: none;
}
.inv-alt-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.inv-alt-row {
  display: grid;
  grid-template-columns: 90px 90px auto 90px minmax(48px, auto) auto;
  gap: 6px;
  align-items: center;
}
.inv-alt-eq,
.inv-alt-base {
  color: var(--muted);
  font-weight: 700;
}
.inv-recipe-unit-select {
  min-height: 34px;
  padding: 0 6px;
}
.inv-muted {
  color: var(--muted);
}
.inv-small {
  font-size: 0.82em;
}
.inv-row-low {
  background: rgba(214, 83, 63, 0.06);
}
.inv-low-value {
  color: var(--coral);
  font-weight: 700;
}
.inv-name-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--teal);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.inv-name-btn:hover {
  text-decoration: underline;
}
.inv-row-actions {
  text-align: right;
  white-space: nowrap;
}
.inv-edit-row > td {
  background: var(--surface-strong);
  padding: 14px 16px;
}
.inv-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.inv-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 12px;
}
.inv-form-grid label,
.inv-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}
.inv-form-wide {
  grid-column: 1 / -1;
}
.inv-form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.inv-adjust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.inv-adjust-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* Restock / count / manual cards have different field counts; the submit button
   sits at the bottom of each card so the three buttons line up (2026-11-17). */
.inv-adjust-card > button[type="submit"] {
  margin-top: auto;
}
.inv-adjust-card h4 {
  margin: 0;
  font-size: 0.9rem;
}
.inv-textarea {
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}
.inv-recipe-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.inv-recipe-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface);
}
.inv-recipe-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}
.inv-recipe-title {
  font-size: 0.98rem;
}
.inv-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.inv-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--ink);
}
.inv-chip-warn {
  background: rgba(214, 83, 63, 0.12);
  border-color: rgba(214, 83, 63, 0.35);
  color: var(--coral);
}
.inv-chip-recipe { background: rgba(15, 118, 110, 0.08); border-color: rgba(15, 118, 110, 0.25); }
.inv-chip-set { background: rgba(15, 118, 110, 0.12); border-color: rgba(15, 118, 110, 0.3); color: var(--teal-dark); font-weight: 600; }
.inv-recipe-card-editing {
  grid-column: 1 / -1;
}
.inv-recipe-card-set {
  background: rgba(15, 118, 110, 0.07);
  border-color: rgba(15, 118, 110, 0.35);
}
.inv-recipe-set-warning {
  margin: 0;
  padding: 10px 12px;
  border: 1.5px solid var(--amber);
  border-left-width: 5px;
  border-radius: var(--radius);
  background: rgba(194, 122, 24, 0.1);
  color: var(--ink);
  font-weight: 500;
}
.inv-recipe-card-saved {
  border-color: var(--teal-dark);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.25);
  transition: box-shadow 0.3s, border-color 0.3s;
}
.inv-recipe-head {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.inv-recipe-head > label:first-child {
  flex: 1;
}
.inv-form .inv-recipe-set-toggle {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding-bottom: 10px;
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}
.inv-recipe-picker {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 96px 84px auto;
  gap: 8px;
  align-items: center;
}
.inv-recipe-search {
  position: relative;
}
.inv-recipe-suggest {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.inv-recipe-suggest-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.inv-recipe-suggest-row.active,
.inv-recipe-suggest-row:hover {
  background: rgba(15, 118, 110, 0.1);
}
.inv-recipe-suggest-empty {
  padding: 10px 12px;
  color: var(--coral);
  font-size: 0.85rem;
}
.inv-recipe-unit {
  color: var(--muted);
  font-size: 0.85rem;
}
.inv-recipe-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.inv-recipe-item {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 96px 84px auto;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}
.inv-recipe-item-name {
  display: flex;
  flex-direction: column;
}
.inv-recipe-item-noqty input {
  border-color: var(--coral);
}
.inv-recipe-item-missing {
  border-color: rgba(214, 83, 63, 0.5);
  background: rgba(214, 83, 63, 0.08);
}
.inv-recipe-item-missing .inv-small {
  color: var(--coral);
}
.inv-recipe-item-flash {
  border-color: var(--teal-dark);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.25);
}
@media (max-width: 640px) {
  .inv-recipe-picker,
  .inv-recipe-item {
    grid-template-columns: 1fr 80px 64px auto;
  }
  .inv-alt-row {
    grid-template-columns: 64px 64px auto 64px minmax(40px, auto) auto;
  }
}
.inv-chip-deduction { background: rgba(15, 118, 110, 0.12); border-color: rgba(15, 118, 110, 0.3); color: var(--teal-dark); }
.inv-chip-restock { background: rgba(47, 125, 72, 0.12); border-color: rgba(47, 125, 72, 0.3); color: var(--green); }
.inv-io-hint { margin: 0; align-self: center; }
.inv-chip-outgoing { background: rgba(180, 83, 9, 0.12); border-color: rgba(180, 83, 9, 0.3); color: var(--amber); }
.inv-chip-restore { background: rgba(194, 122, 24, 0.12); border-color: rgba(194, 122, 24, 0.3); color: var(--amber); }
.inv-chip-physical-count,
.inv-chip-manual { background: var(--bg); }
.inv-neg { color: var(--coral); }
.inv-pos { color: var(--green); }
.inv-map-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.inv-map-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.4fr) minmax(180px, 2fr) 84px auto 64px;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.inv-map-row:last-child {
  border-bottom: 0;
}
.inv-map-head {
  background: var(--surface-strong);
  font-weight: 600;
  color: var(--muted);
  font-size: 0.85rem;
}
.inv-map-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-weight: 600;
}
.inv-row-unmapped {
  background: rgba(194, 122, 24, 0.05);
}
.inv-map-option-name {
  padding-left: 14px;
  font-weight: 400;
  color: var(--muted);
}
.inv-mult {
  width: 100%;
  text-align: right;
}
.inv-map-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}
.inv-map-row .inv-chip {
  justify-self: start;
  white-space: nowrap;
}
.inv-chip-selling { background: rgba(47, 125, 72, 0.12); border-color: rgba(47, 125, 72, 0.3); color: var(--green); }
.inv-chip-hidden { color: var(--muted); }
.inv-io-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
@media (max-width: 720px) {
  .inv-map-row {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: min-content;
  }
  .inv-map-head {
    display: none;
  }
}

/* Inventory: store bar, categories, wastage/receiving stats */
.inv-store-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 4px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line, #e3e3e8);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.02);
}
.inv-store-pick { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.inv-store-pick select { min-width: 200px; }
/* "Store" label kept on one line (the select squeezed it to one letter per line). */
.inv-store-pick > span { flex: 0 0 auto; white-space: nowrap; }
.inv-store-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1 1 320px; }
.inv-store-form .field { flex: 1 1 140px; min-width: 120px; }
.inv-cat-form { margin-bottom: 12px; }

.inv-stats { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0; }
.inv-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 110px;
  padding: 10px 14px;
  border: 1px solid var(--line, #e3e3e8);
  border-radius: 10px;
}
.inv-stat span { font-size: 12px; opacity: 0.7; }
.inv-stat strong { font-size: 20px; font-variant-numeric: tabular-nums; }

.inv-stat-bars { display: grid; gap: 6px; margin: 8px 0 12px; }
.inv-stat-bar {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(80px, 2fr) auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.inv-stat-bar b { font-variant-numeric: tabular-nums; opacity: 0.85; }
.inv-bar { height: 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.08); overflow: hidden; }
.inv-bar i { display: block; height: 100%; background: var(--accent, #2f6fed); border-radius: 999px; }

.inv-hidden { display: none !important; }

@media (max-width: 720px) {
  .inv-store-pick select { min-width: 140px; }
  .inv-stat-bar { grid-template-columns: 1fr; gap: 2px; }
}
.inv-subhead { margin: 18px 0 8px; font-size: 15px; font-weight: 700; }

