/* ==========================================================================
   Inventory demo — warehouse stock table with live updates
   All classes prefixed with invx- to avoid collisions with .inv-* legacy.
   Assumes parent .dd-visual already provides padded dotted-grid backdrop.
   ========================================================================== */

.invx-card {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  font-family: inherit;
}

/* ----- Header ------------------------------------------------------------ */
.invx-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #FBFBFD, #fff);
}
.invx-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.invx-head-icon {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--navy-50);
  color: var(--navy);
  flex-shrink: 0;
}
.invx-head-icon [data-lucide] { width: 16px; height: 16px; }
.invx-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.2;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.invx-title-em { color: var(--navy); font-weight: 800; }
.invx-sub {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.invx-head-right { display: flex; align-items: center; gap: 8px; }

/* Live sync pill */
.invx-live {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--green-50);
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.invx-live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  animation: invx-pulse 1.6s infinite;
}
@keyframes invx-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Replay button */
.invx-replay {
  display: none;
  align-items: center; gap: 6px;
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 6px 11px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, background .15s ease;
}
.invx-replay [data-lucide] { width: 13px; height: 13px; }
.invx-replay:hover { background: #1f1d5e; transform: translateY(-1px); }
.invx-replay.show { display: inline-flex; animation: invx-fadeIn .3s ease; }
@keyframes invx-fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ----- Tabs -------------------------------------------------------------- */
.invx-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 14px 0;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.invx-tab {
  background: none;
  border: none;
  padding: 8px 14px 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color .18s ease, border-color .18s ease;
  position: relative;
  top: 1px;
}
.invx-tab [data-lucide] { width: 13px; height: 13px; opacity: .75; }
.invx-tab:hover { color: var(--ink); }
.invx-tab.act {
  color: var(--navy);
  border-bottom-color: var(--orange);
}
.invx-tab.act [data-lucide] { opacity: 1; color: var(--orange); }

/* ----- Table ------------------------------------------------------------- */
.invx-table-wrap {
  position: relative;
  padding: 8px 10px 14px;
  background: #fff;
  transition: opacity .22s ease;
}
.invx-table-wrap.swap { opacity: 0; }

.invx-thead {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) 1fr 1fr 1fr;
  gap: 10px;
  padding: 10px 12px 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px dashed var(--border);
}
.invx-thead > div:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }

.invx-rows { display: flex; flex-direction: column; }

.invx-row {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) 1fr 1fr 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  transition: background-color .5s ease;
  border-radius: 8px;
}
.invx-row:last-child { border-bottom: none; }
.invx-row.highlight { background: var(--orange-50); }
.invx-row.highlight-green { background: var(--green-50); }

/* Product cell */
.invx-prod { display: flex; align-items: center; gap: 10px; min-width: 0; }
.invx-thumb {
  width: 34px; height: 34px;
  border-radius: 9px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--navy-50), #fff);
  display: grid; place-items: center;
  color: var(--navy);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  text-transform: uppercase;
}
.invx-thumb[data-tone="orange"] { background: linear-gradient(135deg, #FFE2C7, #FFF3E8); color: #B55411; border-color: #FFD0A8; }
.invx-thumb[data-tone="navy"]   { background: linear-gradient(135deg, #D7D6F2, #EEEEF7); color: var(--navy); border-color: #C6C4E8; }
.invx-thumb[data-tone="green"]  { background: linear-gradient(135deg, #BFEEDC, #E8F8F2); color: #0F7A5A; border-color: #A9E6D0; }
.invx-thumb[data-tone="red"]    { background: linear-gradient(135deg, #FBC7C7, #FEECEC); color: #B02020; border-color: #F5B5B5; }
.invx-thumb[data-tone="sky"]    { background: linear-gradient(135deg, #C5DCF6, #E6F0FB); color: #1F5DA8; border-color: #B2CDEE; }
.invx-thumb[data-tone="plum"]   { background: linear-gradient(135deg, #E6CFEC, #F5E7F5); color: #793584; border-color: #DABAE1; }
.invx-thumb[data-tone="sun"]    { background: linear-gradient(135deg, #FCE3A1, #FFF6DC); color: #8A6211; border-color: #F0D487; }
.invx-thumb[data-tone="mint"]   { background: linear-gradient(135deg, #C4F0E1, #E8FBF3); color: #0B7A5A; border-color: #ABE6D0; }
.invx-thumb[data-tone="slate"]  { background: linear-gradient(135deg, #C8CDD6, #E4E7EE); color: #404A5C; border-color: #B4BAC6; }
.invx-thumb[data-tone="rose"]   { background: linear-gradient(135deg, #F5CDDB, #FCE8EF); color: #9A2A54; border-color: #EAB6CB; }

.invx-prod-meta { min-width: 0; }
.invx-prod-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.invx-prod-sku {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-top: 2px;
}

/* Number cells */
.invx-num {
  text-align: right;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  padding: 3px 6px;
  border-radius: 6px;
  display: inline-block;
  justify-self: end;
  transition: background-color .4s ease, color .4s ease;
}
.invx-num.low { color: var(--red); }
.invx-num.glow-orange {
  background: var(--orange-50);
  color: var(--orange);
  animation: invx-glowOrange 1s ease;
}
.invx-num.glow-green {
  background: var(--green-50);
  color: var(--green);
  animation: invx-glowGreen 1s ease;
}
@keyframes invx-glowOrange {
  0%   { background: rgba(255, 129, 35, 0); color: var(--ink); }
  30%  { background: var(--orange-50); color: var(--orange); }
  100% { background: var(--orange-50); color: var(--orange); }
}
@keyframes invx-glowGreen {
  0%   { background: rgba(16, 185, 129, 0); color: var(--ink); }
  30%  { background: var(--green-50); color: var(--green); }
  100% { background: var(--green-50); color: var(--green); }
}

/* ----- Toast ------------------------------------------------------------- */
.invx-toast {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  color: var(--ink);
  max-width: 320px;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: transform .32s cubic-bezier(.2, .8, .2, 1), opacity .28s ease;
  z-index: 5;
}
.invx-toast.show { transform: translateY(0); opacity: 1; }
.invx-toast-icon {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--orange-50);
  color: var(--orange);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.invx-toast.delivery .invx-toast-icon {
  background: var(--green-50);
  color: var(--green);
}
.invx-toast-icon [data-lucide] { width: 15px; height: 15px; }
.invx-toast-body { min-width: 0; line-height: 1.3; }
.invx-toast-title {
  font-weight: 800;
  font-size: 12px;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.invx-toast-sub {
  font-size: 11.5px;
  color: var(--ink-2);
  margin-top: 2px;
}
.invx-toast-sub b { color: var(--ink); font-weight: 700; }

/* ----- Responsive -------------------------------------------------------- */
@media (max-width: 520px) {
  .invx-head { padding: 12px 14px; }
  .invx-tabs { padding: 8px 10px 0; }
  .invx-tab { padding: 8px 10px 10px; font-size: 11px; }
  .invx-thead, .invx-row { grid-template-columns: minmax(0, 1.8fr) 1fr 1fr 1fr; gap: 6px; padding: 10px 8px; }
  .invx-prod-name { max-width: 150px; font-size: 12px; }
  .invx-prod-sku { font-size: 9.5px; }
  .invx-num { font-size: 12.5px; padding: 3px 4px; }
  .invx-thumb { width: 30px; height: 30px; }
  .invx-toast { right: 10px; bottom: 10px; max-width: 260px; font-size: 12px; }
  .invx-live { padding: 4px 8px; font-size: 10px; }
}
