/* =============================================
   ITPA Inventario PCs — Design System & Styles
   ============================================= */

/* ---------- Google Font ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  /* Palette — Dark Premium */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-elevated: #334155;
  --bg-input: #0f172a;
  --border-color: #334155;
  --border-light: #475569;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --text-accent: #818cf8;

  /* Accent */
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, .25);

  /* Status Colors */
  --status-green: #22c55e;
  --status-green-bg: rgba(34, 197, 94, .15);
  --status-red: #ef4444;
  --status-red-bg: rgba(239, 68, 68, .15);
  --status-yellow: #eab308;
  --status-yellow-bg: rgba(234, 179, 8, .15);
  --status-blue: #3b82f6;
  --status-blue-bg: rgba(59, 130, 246, .15);
  --status-gray: #475569;
  --status-gray-bg: rgba(71, 85, 105, .15);
  --status-orange: #f97316;
  --status-orange-bg: rgba(249, 115, 22, .15);

  /* Sizing */
  --sidebar-width: 280px;
  --header-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  /* Transitions */
  --transition: .3s ease;
  --transition-fast: .15s ease;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: inherit;
}

input,
select,
textarea {
  font-family: inherit;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* =================== LAYOUT =================== */

/* ---------- Header ---------- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(15, 23, 42, .85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 100;
  gap: 16px;
}

.header__menu-btn {
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.header__menu-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
  color: var(--accent);
}

.header__title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.02em;
  flex: 1;
}

.header__title span {
  color: var(--accent);
}

.header__user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--accent-glow);
  border: 1px solid rgba(99, 102, 241, .3);
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 500;
  color: var(--accent-hover);
  transition: var(--transition);
}

.header__user-badge.hidden {
  display: none;
}

.header__user-badge svg {
  width: 16px;
  height: 16px;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: calc(-1 * var(--sidebar-width));
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  z-index: 90;
  transition: left var(--transition);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar.open {
  left: 0;
}

.sidebar__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 85;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.sidebar__overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.sidebar__section {
  padding: 20px 16px 8px;
}

.sidebar__section-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.sidebar__nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition-fast);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.sidebar__nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.sidebar__nav-item.active {
  background: var(--accent-glow);
  color: var(--accent-hover);
}

.sidebar__nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar__footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

/* ---------- Main Content ---------- */
.main {
  margin-top: var(--header-height);
  padding: 24px 20px 40px;
  min-height: calc(100vh - var(--header-height));
  transition: var(--transition);
}

.section {
  display: none;
}

.section.active {
  display: block;
}

/* =================== SUMMARY CARDS =================== */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.summary-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-light);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}

.summary-card__number {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 6px;
}

.summary-card__label {
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Card accent colors */
.summary-card--total::before {
  background: var(--accent);
}

.summary-card--total .summary-card__number {
  color: var(--accent);
}

.summary-card--available::before {
  background: var(--status-green);
}

.summary-card--available .summary-card__number {
  color: var(--status-green);
}

.summary-card--inuse::before {
  background: var(--status-red);
}

.summary-card--inuse .summary-card__number {
  color: var(--status-red);
}

.summary-card--exception::before {
  background: var(--status-yellow);
}

.summary-card--exception .summary-card__number {
  color: var(--status-yellow);
}

.summary-card--staff::before {
  background: var(--status-blue);
}

.summary-card--staff .summary-card__number {
  color: var(--status-blue);
}

.summary-card--empty::before {
  background: var(--status-gray);
}

.summary-card--empty .summary-card__number {
  color: var(--status-gray);
}

/* =================== CART VISUALIZATION =================== */
.cart-section__title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-section__title svg {
  color: var(--accent);
}

.cart-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
}

.cart-shelf {
  margin-bottom: 20px;
}

.cart-shelf:last-child {
  margin-bottom: 0;
}

.cart-shelf__label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-shelf__label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.cart-shelf__grid {
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  gap: 6px;
}

/* ---------- Slot (Ranura) ---------- */
.slot {
  position: relative;
  aspect-ratio: .55;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  overflow: hidden;
}

.slot::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: .15;
  transition: opacity var(--transition-fast);
}

.slot:hover {
  transform: translateY(-4px) scale(1.08);
  z-index: 5;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .4);
}

.slot:hover::before {
  opacity: .3;
}

.slot.selected {
  border-color: #fff !important;
  box-shadow: 0 0 0 2px var(--accent), 0 8px 20px rgba(0, 0, 0, .4);
  transform: translateY(-4px) scale(1.08);
}

.slot[draggable="true"] {
  cursor: grab;
}

.slot[draggable="true"]:active {
  cursor: grabbing;
}

.slot.dragging {
  opacity: .5;
  transform: scale(.9);
  border: 2px dashed var(--accent) !important;
}

.slot.drop-over {
  background: var(--accent-glow) !important;
  border: 2px solid var(--accent) !important;
  transform: scale(1.1);
  box-shadow: 0 0 15px var(--accent-glow);
  z-index: 10;
}

.slot__icon {
  width: 65%;
  height: 55%;
  position: relative;
  z-index: 1;
}

.slot__label {
  font-size: .55rem;
  font-weight: 700;
  margin-top: 2px;
  position: relative;
  z-index: 1;
  text-align: center;
  line-height: 1.1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}



/* Slot colors */
.slot--vacio {
  background: var(--status-gray-bg);
  border-color: var(--status-gray);
}

.slot--vacio::before {
  background: var(--status-gray);
}

.slot--vacio .slot__icon svg {
  fill: var(--status-gray);
}

.slot--almacenada {
  background: var(--status-green-bg);
  border-color: var(--status-green);
}

.slot--almacenada::before {
  background: var(--status-green);
}

.slot--almacenada .slot__icon svg {
  fill: var(--status-green);
}

.slot--enuso {
  background: var(--status-red-bg);
  border-color: var(--status-red);
}

.slot--enuso::before {
  background: var(--status-red);
}

.slot--enuso .slot__icon svg {
  fill: var(--status-red);
}

.slot--excepcion {
  background: var(--status-yellow-bg);
  border-color: var(--status-yellow);
}

.slot--excepcion::before {
  background: var(--status-yellow);
}

.slot--excepcion .slot__icon svg {
  fill: var(--status-yellow);
}

.slot--mantenimiento {
  background: var(--status-orange-bg);
  border-color: var(--status-orange);
}

.slot--mantenimiento::before {
  background: var(--status-orange);
}

.slot--mantenimiento .slot__icon svg {
  fill: var(--status-orange);
}

.slot--staff {
  background: var(--status-blue-bg);
  border-color: var(--status-blue);
}

.slot--staff::before {
  background: var(--status-blue);
}

.slot--staff .slot__icon svg {
  fill: var(--status-blue);
}

.slot--reserva {
  background: var(--status-blue-bg);
  border-color: var(--status-blue);
  opacity: 0.8;
}

.slot--reserva::before {
  background: var(--status-blue);
}

.slot--reserva .slot__icon svg {
  fill: var(--status-blue);
}

.slot--carga_obligada {
  background: var(--status-yellow-bg);
  border-color: var(--status-yellow);
}

.slot--carga_obligada::before {
  background: var(--status-yellow);
}

.slot--carga_obligada .slot__icon svg {
  fill: var(--status-yellow);
}

.slot__auth-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 5px;
  z-index: 2;
  box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.2);
}

/* Tooltip */
.slot__tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(.9);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  padding: 6px 10px;
  font-size: .72rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-fast);
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
}

.slot:hover .slot__tooltip {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* =================== LEGEND =================== */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 20px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.legend__item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  color: var(--text-secondary);
}

.legend__dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* =================== ACTION BAR =================== */
.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

/* =================== MODAL =================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  padding: 20px;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(20px) scale(.96);
  transition: transform var(--transition);
  box-shadow: 0 24px 48px rgba(0, 0, 0, .4);
}

.modal-overlay.visible .modal {
  transform: translateY(0) scale(1);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 5;
}

.modal__title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal__close {
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.modal__close:hover {
  background: var(--status-red-bg);
  border-color: var(--status-red);
  color: var(--status-red);
}

.modal__body {
  padding: 24px;
}

.modal__footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  position: sticky;
  bottom: 0;
  background: var(--bg-secondary);
}

/* ---------- Form Elements ---------- */
.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: .88rem;
  transition: var(--transition-fast);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input:disabled,
.form-input[readonly] {
  opacity: .6;
  cursor: not-allowed;
}

.form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: .88rem;
  outline: none;
  transition: var(--transition-fast);
}

.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-select:disabled {
  opacity: .6;
  cursor: not-allowed;
}

textarea.form-input {
  min-height: 70px;
  resize: vertical;
}

/* ---------- Section Divider ---------- */
.form-section {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin: 24px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section svg {
  width: 16px;
  height: 16px;
}

/* ---------- Switch ---------- */
.switch-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.switch {
  position: relative;
  width: 48px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch__slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-elevated);
  border-radius: 26px;
  transition: var(--transition);
  border: 1px solid var(--border-color);
}

.switch__slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  bottom: 2px;
  left: 3px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: var(--transition);
}

.switch input:checked+.switch__slider {
  background: var(--accent);
  border-color: var(--accent);
}

.switch input:checked+.switch__slider::before {
  transform: translateX(21px);
  background: white;
}

.switch-label {
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ---------- Checkbox Grid ---------- */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-input);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  font-size: .82rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.checkbox-item:hover {
  border-color: var(--accent);
}

.checkbox-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.checkbox-item.disabled {
  opacity: .6;
  pointer-events: none;
}

/* =================== BUTTONS =================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn--primary {
  background: var(--accent);
  color: white;
}

.btn--primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn--secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn--secondary:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn--danger {
  background: var(--status-red-bg);
  color: var(--status-red);
  border-color: rgba(239, 68, 68, .3);
}

.btn--danger:hover {
  background: var(--status-red);
  color: white;
}

.btn--success {
  background: var(--status-green-bg);
  color: var(--status-green);
  border-color: rgba(34, 197, 94, .3);
}

.btn--success:hover {
  background: var(--status-green);
  color: white;
}

.btn--sm {
  padding: 6px 14px;
  font-size: .8rem;
}

/* =================== LOGIN =================== */
.login-container {
  max-width: 400px;
  margin: 60px auto;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 40px 32px;
  text-align: center;
}

.login-card__icon {
  width: 64px;
  height: 64px;
  background: var(--accent-glow);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 28px;
}

.login-card__title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-card__subtitle {
  font-size: .88rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.login-card .form-group {
  text-align: left;
}

.login-card .btn {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
  padding: 12px;
}

.login-error {
  font-size: .82rem;
  color: var(--status-red);
  margin-top: 12px;
  min-height: 20px;
}

/* =================== BULK LOAD SECTION =================== */
.bulk-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.bulk-card__title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bulk-card__title svg {
  color: var(--accent);
}

.bulk-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

/* =================== MASS DELIVERY BAR =================== */
.mass-delivery-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, .95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--accent);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 150;
  transform: translateY(100%);
  transition: transform var(--transition);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, .3);
}

.mass-delivery-bar.visible {
  transform: translateY(0);
}

.mass-delivery-bar__info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .88rem;
  font-weight: 500;
}

.mass-delivery-bar__count {
  background: var(--accent);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: .82rem;
}

.mass-delivery-bar__actions {
  display: flex;
  gap: 10px;
}

/* =================== RESPONSIVE =================== */

/* Tablet */
@media (min-width: 768px) {
  .main {
    padding: 32px 40px 60px;
  }

  .cart-shelf__grid {
    gap: 8px;
  }

  .form-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .sidebar.open~.main {
    margin-left: var(--sidebar-width);
  }

  .sidebar__overlay {
    display: none;
  }

  .main {
    transition: margin-left var(--transition);
  }
}

/* Mobile tweaks */
@media (max-width: 767px) {
  .cart-shelf__grid {
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
  }

  .slot__label {
    font-size: .45rem;
  }



  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .bulk-form-row {
    grid-template-columns: 1fr 1fr;
  }

  .header__title {
    font-size: .9rem;
  }

  .modal {
    max-height: 95vh;
    border-radius: var(--radius-sm);
  }

  .mass-delivery-bar {
    flex-direction: column;
    text-align: center;
  }
}

/* =================== ANIMATION KEYFRAMES =================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .6;
  }
}

.animate-in {
  animation: fadeInUp .4s ease forwards;
}

/* Status badge inline */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.status-badge--almacenada {
  background: var(--status-green-bg);
  color: var(--status-green);
}

.status-badge--enuso {
  background: var(--status-red-bg);
  color: var(--status-red);
}

.status-badge--excepcion {
  background: var(--status-yellow-bg);
  color: var(--status-yellow);
}

.status-badge--staff {
  background: var(--status-blue-bg);
  color: var(--status-blue);
}

.status-badge--vacio {
  background: var(--status-gray-bg);
  color: var(--status-gray);
}

.status-badge--mantenimiento {
  background: var(--status-orange-bg);
  color: var(--status-orange);
}

/* Page section title */
.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -.02em;
}

.page-subtitle {
  font-size: .9rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

/* =================== USERS MANAGEMENT =================== */
.users-table {
  width: 100%;
  border-collapse: collapse;
}

.users-table__cell {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.users-table__row:last-child .users-table__cell {
  border-bottom: none;
}

.users-table__row:hover .users-table__cell {
  background: rgba(255, 255, 255, .02);
}

/* =================== TABLE RESPONSIVE WRAPPER =================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* =================== MASS DELIVERY BAR =================== */
.mass-delivery-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, .95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--accent);
  padding: 14px 24px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 150;
  transform: translateY(100%);
  transition: transform .3s ease;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, .3);
}

.mass-delivery-bar.visible {
  display: flex;
  transform: translateY(0);
}

.mass-delivery-bar__info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .88rem;
  font-weight: 500;
}

.mass-delivery-bar__count {
  background: var(--accent);
  color: white;
  padding: 4px 12px;

  /* Desktop */
  @media (min-width: 1024px) {
    .sidebar.open~.main {
      margin-left: var(--sidebar-width);
    }

    .sidebar__overlay {
      display: none;
    }

    .main {
      transition: margin-left var(--transition);
    }
  }

  /* Mobile tweaks */
  @media (max-width: 767px) {
    .cart-shelf__grid {
      grid-template-columns: repeat(10, 1fr);
      gap: 4px;
    }

    .slot__label {
      font-size: .45rem;
    }

    .summary-grid {
      grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
      grid-template-columns: 1fr;
    }

    .bulk-form-row {
      grid-template-columns: 1fr 1fr;
    }

    .header__title {
      font-size: .9rem;
    }

    .modal {
      max-height: 95vh;
      border-radius: var(--radius-sm);
    }

    .mass-delivery-bar {
      flex-direction: column;
      text-align: center;
    }
  }

  /* =================== ANIMATION KEYFRAMES =================== */
  @keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translateY(10px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes pulse {

    0%,
    100% {
      opacity: 1;
    }

    50% {
      opacity: .6;
    }
  }

  .animate-in {
    animation: fadeInUp .4s ease forwards;
  }

  /* Status badge inline */
  .status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
  }

  .status-badge--almacenada {
    background: var(--status-green-bg);
    color: var(--status-green);
  }

  .status-badge--enuso {
    background: var(--status-red-bg);
    color: var(--status-red);
  }

  .status-badge--excepcion {
    background: var(--status-yellow-bg);
    color: var(--status-yellow);
  }

  .status-badge--staff {
    background: var(--status-blue-bg);
    color: var(--status-blue);
  }

  .status-badge--vacio {
    background: var(--status-gray-bg);
    color: var(--status-gray);
  }

  /* Page section title */
  .page-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -.02em;
  }

  .page-subtitle {
    font-size: .9rem;
    color: var(--text-secondary);
    margin-bottom: 28px;
  }

  /* =================== USERS MANAGEMENT =================== */
  .users-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    /* Prevent table squishing on mobile */
  }

  .users-table__cell {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
  }

  .users-table__row:last-child .users-table__cell {
    border-bottom: none;
  }

  .users-table__row:hover .users-table__cell {
    background: rgba(255, 255, 255, .02);
  }

  /* =================== MASS DELIVERY BAR =================== */
  .mass-delivery-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, .95);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--accent);
    padding: 14px 24px;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    z-index: 150;
    transform: translateY(100%);
    transition: transform .3s ease;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, .3);
  }

  .mass-delivery-bar.visible {
    display: flex;
    transform: translateY(0);
  }

  .mass-delivery-bar__info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: .88rem;
    font-weight: 500;
  }

  .mass-delivery-bar__count {
    background: var(--accent);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: .82rem;
  }

  .mass-delivery-bar__actions {
    display: flex;
    gap: 10px;
  }

  /* =================== INVITE LINK =================== */
  .invite-link-cell {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .invite-link-cell .invite-link-input {
    flex: 1;
    min-width: 0;
    font-family: 'JetBrains Mono', monospace;
    cursor: text;
  }

  /* =================== INVITE INFO BANNER =================== */
  .invite-info-banner {
    background: var(--accent-glow);
    border: 1px solid rgba(99, 102, 241, .3);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: .85rem;
    color: var(--accent-hover);
    margin-bottom: 20px;
    text-align: left;
  }

  /* =================== CART SELECTOR =================== */
  .cart-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
  }

  .cart-selector-wrapper label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
  }

  .cart-selector-wrapper select {
    flex: 1;
    max-width: 280px;
  }

  /* =================== FORM ROW 3-COL =================== */
  @media (min-width: 768px) {
    .form-row:has(> :nth-child(3)) {
      grid-template-columns: 1fr 1fr 1fr;
    }
  }
}

/* =================== QR SCANNER =================== */
.qr-scanner-body {
  padding: 16px 24px 24px;
}

.qr-video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}

#qrVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.qr-scan-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Corner brackets */
.qr-scan-corner {
  position: absolute;
  width: 36px;
  height: 36px;
  border-color: var(--accent);
  border-style: solid;
  border-width: 0;
}

.qr-scan-corner--tl {
  top: 20%;
  left: 15%;
  border-top-width: 3px;
  border-left-width: 3px;
  border-radius: 4px 0 0 0;
}

.qr-scan-corner--tr {
  top: 20%;
  right: 15%;
  border-top-width: 3px;
  border-right-width: 3px;
  border-radius: 0 4px 0 0;
}

.qr-scan-corner--bl {
  bottom: 20%;
  left: 15%;
  border-bottom-width: 3px;
  border-left-width: 3px;
  border-radius: 0 0 0 4px;
}

.qr-scan-corner--br {
  bottom: 20%;
  right: 15%;
  border-bottom-width: 3px;
  border-right-width: 3px;
  border-radius: 0 0 4px 0;
}

/* Scanning line */
.qr-scan-line {
  position: absolute;
  left: 15%;
  right: 15%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: qr-scan-move 2s ease-in-out infinite;
  box-shadow: 0 0 8px var(--accent);
  top: 20%;
}

@keyframes qr-scan-move {
  0% {
    top: 20%;
    opacity: 1;
  }

  50% {
    top: 80%;
    opacity: 1;
  }

  100% {
    top: 20%;
    opacity: 1;
  }
}

.qr-scan-status {
  text-align: center;
  font-size: .85rem;
  color: var(--text-secondary);
  margin-top: 16px;
  min-height: 20px;
}

.qr-scan-error {
  text-align: center;
  font-size: .82rem;
  color: var(--status-red);
  margin-top: 8px;
  min-height: 20px;
}

/* =================== QUICK CHECKOUT =================== */
.qc-laptop-info {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}

.qc-laptop-info__icon {
  color: var(--accent);
  flex-shrink: 0;
  opacity: .9;
}

.qc-laptop-info__id {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1;
  margin-bottom: 6px;
}

.qc-laptop-info__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.qc-current-info {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .82rem;
  color: var(--text-secondary);
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* One-touch action buttons */
.qc-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.qc-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 12px;
  border: 2px solid var(--qc-color, var(--accent));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--qc-color, var(--accent)) 10%, transparent);
  color: var(--qc-color, var(--accent));
  font-family: inherit;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s ease;
  text-align: center;
}

.qc-action-btn:hover {
  background: color-mix(in srgb, var(--qc-color, var(--accent)) 25%, transparent);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .3);
}

.qc-action-btn.selected {
  background: color-mix(in srgb, var(--qc-color, var(--accent)) 30%, transparent);
  box-shadow: 0 0 0 2px var(--qc-color, var(--accent)), 0 8px 20px rgba(0, 0, 0, .3);
  transform: translateY(-3px) scale(1.03);
}

.qc-action-btn__icon {
  font-size: 2rem;
  line-height: 1;
}

.qc-action-btn__label {
  line-height: 1.2;
}

/* =================== SWAP MODAL =================== */
.swap-section-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.swap-source-info {
  background: var(--status-red-bg);
  border: 1px solid rgba(239, 68, 68, .3);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.swap-source-info__id {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.swap-source-info__details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: .82rem;
  color: var(--text-secondary);
}

.swap-available-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}

.swap-slot-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s ease;
}

.swap-slot-item:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-elevated));
}

.swap-slot-item.selected {
  border-color: var(--status-green);
  background: var(--status-green-bg);
  box-shadow: 0 0 0 2px var(--status-green);
}

.swap-slot-item__id {
  font-size: 1rem;
  font-weight: 700;
  min-width: 64px;
}

.swap-slot-item__detail {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.swap-slot-item__hw {
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* =================== EXTRA BUTTON VARIANTS =================== */
.btn--warning {
  background: rgba(245, 158, 11, .15);
  border: 1px solid #f59e0b;
  color: #f59e0b;
}

.btn--warning:hover:not(:disabled) {
  background: rgba(245, 158, 11, .28);
  border-color: #fbbf24;
  box-shadow: 0 4px 14px rgba(245, 158, 11, .25);
}

.btn--return {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  border: 1px solid #22c55e;
  color: #fff;
  font-weight: 700;
  padding: 10px 18px;
  box-shadow: 0 4px 14px rgba(34, 197, 94, .25);
  transition: all .15s ease;
}

.btn--return:hover:not(:disabled) {
  background: linear-gradient(135deg, #22c55e, #4ade80);
  box-shadow: 0 6px 20px rgba(34, 197, 94, .4);
  transform: translateY(-1px);
}

.btn--return:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* =================== QR SCANNER ANIMATION =================== */
.qr-scanner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
}

.qr-scanner-box {
  width: min(70%, 250px);
  aspect-ratio: 1/1;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  position: relative;
  box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.45);
}

.qr-scanner-line {
  position: absolute;
  width: 90%;
  left: 5%;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  top: 0;
  animation: qr-scan 2s infinite ease-in-out;
}

@keyframes qr-scan {
  0% {
    top: 10%;
    opacity: 0;
  }

  10% {
    opacity: 1;
  }

  90% {
    opacity: 1;
  }

  100% {
    top: 90%;
    opacity: 0;
  }
}

.qr-scanner-corner {
  position: absolute;
  width: 25px;
  height: 25px;
  border: 4px solid var(--accent);
}

.qr-scanner-corner--tl {
  top: -2px;
  left: -2px;
  border-right: 0;
  border-bottom: 0;
  border-top-left-radius: 12px;
}

.qr-scanner-corner--tr {
  top: -2px;
  right: -2px;
  border-left: 0;
  border-bottom: 0;
  border-top-right-radius: 12px;
}

.qr-scanner-corner--bl {
  bottom: -2px;
  left: -2px;
  border-right: 0;
  border-top: 0;
  border-bottom-left-radius: 12px;
}

.qr-scanner-corner--br {
  bottom: -2px;
  right: -2px;
  border-left: 0;
  border-top: 0;
  border-bottom-right-radius: 12px;
}

/* Remote Scanner Toggle */
#qrRemoteToggle {
  cursor: pointer;
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

.qc-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  color: var(--text-primary);
  transition: var(--transition-fast);
  cursor: pointer;
}

.qc-action-btn:hover {
  background: var(--bg-card);
  border-color: var(--qc-color, var(--accent));
  transform: translateY(-2px);
}

.qc-action-btn.selected {
  background: var(--accent-glow);
  border-color: var(--qc-color, var(--accent));
  box-shadow: 0 0 0 2px var(--qc-color, var(--accent));
}

.qc-action-btn__icon {
  font-size: 1.5rem;
}

.qc-action-btn__label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .02em;
}

/* =================== AUTOCOMPLETE =================== */
.autocomplete-results {
  position: fixed;
  /* JS sets top/left/width via getBoundingClientRect */
  background: var(--bg-elevated);
  border: 2px solid #3b82f6;
  border-radius: var(--radius-xs);
  max-height: 250px;
  overflow-y: auto;
  z-index: 99999;
  /* Over modals */
  display: none;
  box-shadow: 0 10px 25px rgba(0, 0, 0, .6);
}

.autocomplete-results.visible {
  display: block;
}

.autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: .88rem;
  transition: var(--transition-fast);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
  background: var(--accent-glow);
  color: var(--accent-hover);
}

.autocomplete-item strong {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* =================== LOAN ALARM BADGE =================== */
@keyframes alarm-pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.2);
  }
}

#loanAlarmBadge {
  animation: alarm-pulse 2s ease-in-out infinite;
}

/* =================== CONFIG SIDEBAR SECTION =================== */
#configSectionItems {
  transition: all var(--transition);
}

/* =================== ALARM ITEM =================== */
.alarm-item {
  transition: var(--transition-fast);
}

.alarm-item:hover {
  background: var(--bg-elevated) !important;
}

/* =================== DRAG & DROP REORDERING =================== */
.users-table__row[draggable="true"] {
  cursor: default;
}

.drag-handle {
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: var(--radius-xs);
  transition: var(--transition-fast);
}

.drag-handle:hover {
  background: var(--bg-elevated);
  color: var(--accent);
}

.drag-handle:active {
  cursor: grabbing;
}

.users-table__row.dragging {
  opacity: 0.5;
  background: var(--bg-elevated);
}

.users-table__row.drop-target-top {
  border-top: 2px solid var(--accent) !important;
}

.users-table__row.drop-target-bottom {
  border-bottom: 2px solid var(--accent) !important;
}