.inventory-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 16px; }
.vending-frame { border-radius: 28px; padding: 16px; background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.04)); border: 1px solid var(--line); }
#springGrid { container-type: inline-size; }
.spring-drawer { padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: rgba(0,0,0,.10); }
.spring-drawer + .spring-drawer { margin-top: 16px; }
.spring-drawer-title { margin: 0 0 12px; color: var(--muted); font-size: 13px; font-weight: 700; }
.spring-drawer-products { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-flow: row; gap: 16px; min-width: 0; width: 100%; direction: ltr; }
.spring-position-gap { min-height: 300px; }
.spring-cell { isolation: isolate; min-width: 0; height: 300px; border-radius: 18px; border: 1px solid var(--line); background: #171b25; padding: 12px; position: relative; transition: .16s ease; overflow: hidden; text-align: start; color: #fff; }
html[dir="rtl"] #springGrid .spring-cell { direction: rtl; }
.spring-cell:hover, .spring-cell.selected { transform: translateY(-2px); border-color: rgba(94,234,212,.62); }
.spring-cell.disabled { opacity: 1; border-style: dashed; }
.spring-product-image { position: absolute; inset: 0; z-index: 0; overflow: hidden; background: #171b25; }
.spring-product-image img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 40%; filter: none; opacity: 1; transform: none; }
.spring-product-fade { position: absolute; inset: auto 0 0; z-index: 1; height: 75%; pointer-events: none; background: linear-gradient(to top, rgb(9 14 30 / 1) 0%, rgb(9 14 30 / .97) 26%, rgb(9 14 30 / .82) 48%, rgb(9 14 30 / .35) 76%, transparent 100%); }
.spring-card-content { position: absolute; inset: auto 12px 12px; z-index: 2; display: block; text-align: start; }
.spring-cell .spring-no { display: flex; justify-content: space-between; align-items: center; color: rgba(255,255,255,.82); font-size: 13px; margin-bottom: 8px; }
.spring-type-tag { border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 2px 7px; font-size: 10px; font-weight: 700; }
.spring-cell[data-line-type="1"] { border-color: rgba(251,191,36,.55); }
.spring-cell .product-name { display: -webkit-box; min-height: 2.4em; overflow: hidden; font-size: 15px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.spring-cell .product-meta { display: flex; justify-content: space-between; gap: 8px; color: rgba(255,255,255,.82); font-size: 14px; font-weight: 700; margin-top: 8px; }
.spring-card-content .stock-bar { height: 7px; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,.18); margin-top: 10px; }
.stock-bar span { display: block; height: 100%; border-radius: inherit; background: var(--stock-color); width: calc(var(--stock-percent) * 1%); }
.row-note { color: var(--muted); font-size: 13px; margin-top: 12px; line-height: 1.5; }

.spring-cell.empty .product-name { color: var(--muted); font-style: italic; }

@container (max-width: 680px) {
  .spring-drawer-products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (max-width: 430px) {
  .spring-drawer-products { grid-template-columns: minmax(0, 1fr); }
}

.spring-fill-btn { white-space: nowrap; }
.spring-state-control { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.spring-state-control small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.spring-state-toggle {
  min-width: 104px;
  min-height: 36px;
  border: 1px solid rgba(52, 211, 153, .5);
  border-radius: 999px;
  padding: 7px 14px;
  color: var(--text);
  background: rgba(52, 211, 153, .18);
  font-weight: 800;
  cursor: pointer;
  transition: .16s ease;
}
.spring-state-toggle.is-inactive {
  border-color: rgba(251, 113, 133, .5);
  background: rgba(251, 113, 133, .16);
}
.spring-state-toggle.is-pending,
.spring-state-toggle:disabled {
  opacity: .58;
  cursor: not-allowed;
}
.spring-state-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

/* Spring editor modal — hidden on desktop, shown as bottom-sheet on mobile */
.spring-editor-modal {
  display: none;
}

.spring-editor-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 999;
}

.spring-editor-modal-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.4);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.spring-editor-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 0;
  flex-shrink: 0;
}

.spring-editor-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.spring-editor-modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}

.spring-editor-modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.spring-editor-modal-body {
  padding: 16px 20px 24px;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 780px) {
  .spring-editor-modal.is-open {
    display: block;
  }

  /* Hide the desktop side panel on mobile — the modal replaces it */
  .inventory-layout .panel:last-child {
    display: none;
  }
}

@media (min-width: 781px) {
  .spring-editor-modal {
    display: none !important;
  }
}
