.app-loading {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.react-shell {
  min-height: 100vh;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.secondary-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.form-grid.compact {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
}

.form-grid.compact h2,
.form-grid.compact .wide,
.form-grid.compact .button-row {
  grid-column: 1 / -1;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.table-tools {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.table-tools p {
  margin: 0;
  color: var(--muted);
}

.login-error {
  margin-top: 14px;
}

@media (max-width: 900px) {
  .form-grid.compact {
    grid-template-columns: 1fr;
  }
}

/* Modal styling */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  width: min(540px, 90vw);
  padding: 24px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: scaleIn 0.2s ease-out;
}

.modal-content.movements-modal {
  width: min(720px, 95vw);
}

.modal-content h3 {
  margin: 0 0 16px;
}

.barcode-wrapper {
  display: flex;
  justify-content: center;
  padding: 20px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid var(--line);
  margin-bottom: 20px;
}

.movements-list-container {
  overflow-y: auto;
  margin-bottom: 20px;
}

.movements-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 100%;
}

.type-in {
  color: var(--green);
  font-weight: bold;
}
.type-out {
  color: var(--danger);
  font-weight: bold;
}
.type-adj {
  color: var(--blue);
  font-weight: bold;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Button & Actions styling */
.btn-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.action-btn {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: all 0.15s ease;
}
.action-btn:hover {
  transform: translateY(-1px);
}
.action-btn.edit {
  color: var(--blue);
  border-color: #bfdbfe;
  background: #eff6ff;
}
.action-btn.edit:hover {
  background: #dbeafe;
}
.action-btn.delete {
  color: var(--danger);
  border-color: #fecaca;
  background: #fef2f2;
}
.action-btn.delete:hover {
  background: #fee2e2;
}
.action-btn.movements {
  color: var(--indigo);
  border-color: #e0e7ff;
  background: #eef2ff;
}
.action-btn.movements:hover {
  background: #e0e7ff;
}
.action-btn.barcode {
  color: var(--muted);
  border-color: var(--line);
  background: var(--soft);
}
.action-btn.barcode:hover {
  background: var(--line);
  color: var(--ink);
}

/* Multi-item Invoice/Purchase Form */
.document-form {
  display: flex;
  flex-direction: column;
}

.form-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
}

.items-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 16px 0 12px;
}

.items-header h3 {
  margin: 0;
}

.items-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.item-row {
  display: grid;
  grid-template-columns: 1.2fr 1.5fr 0.6fr 0.8fr 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  background: var(--soft);
  border-radius: 8px;
  border: 1px solid var(--line);
}

.item-row label {
  margin-bottom: 0;
  margin-top: 0;
}

.item-total {
  display: flex;
  flex-direction: column;
  text-align: right;
  padding-bottom: 8px;
}

.item-total span {
  font-size: 11px;
  color: var(--muted);
}

.remove-item-btn {
  background: #fee2e2;
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-weight: bold;
  font-size: 18px;
  margin-bottom: 8px;
}

.remove-item-btn:hover {
  background: var(--danger);
  color: #fff;
}

.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 2px solid var(--line);
}

.grand-total {
  display: flex;
  flex-direction: column;
  text-align: right;
}

.grand-total span {
  font-size: 13px;
  color: var(--muted);
}

.grand-total strong {
  font-size: 24px;
  color: var(--ink);
}

.add-item-btn {
  min-height: 36px;
  padding: 0 10px;
  font-size: 13px;
}

@media (max-width: 1200px) {
  .item-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .item-total, .remove-item-btn {
    grid-column: span 1;
  }
}

