#edit-product-form,
#edit-part-form,
#edit-supplier-form,
#edit-service-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
}

#edit-product-form .form-group,
#edit-part-form .form-group,
#edit-supplier-form .form-group,
#edit-service-form .form-group {
  min-width: 0;
}

#edit-product-form .form-group > div,
#edit-part-form .form-group > div,
#edit-service-form .form-group > div {
  min-width: 0;
}

#edit-product-form input,
#edit-product-form select,
#edit-part-form input,
#edit-part-form select,
#edit-supplier-form input,
#edit-supplier-form select,
#edit-service-form input,
#edit-service-form select,
#edit-service-form textarea {
  max-width: 100%;
  box-sizing: border-box;
}

#edit-product-form button,
#edit-part-form button,
#edit-supplier-form button,
#edit-service-form button {
  grid-column: span 1;
}

@media (max-width: 520px) {
  #edit-product-form,
  #edit-part-form,
  #edit-supplier-form,
  #edit-service-form {
    grid-template-columns: 1fr;
  }
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 1rem;
}

#app {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 2rem;
  text-align: center;
  position: relative;
  overflow: visible;
}

header h1 {
  font-size: 2rem;
  font-weight: 600;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.header-btn {
  background: #667eea !important;
  color: white !important;
  border: none !important;
  padding: 8px 15px !important;
  cursor: pointer !important;
  border-radius: 6px;
}

.header-btn-logout {
  background: #e74c3c !important;
}

@media (max-width: 768px) {
  header {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .header-inner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    width: 100%;
  }

  header h1 {
    font-size: 1.35rem;
    margin: 0;
  }

  .header-actions {
    justify-content: center;
    flex-wrap: wrap;
    position: static !important;
  }
}

.tabs {
  display: flex;
  border-bottom: 2px solid #e0e0e0;
  background: #f9f9f9;
  flex-wrap: wrap;
}

.tab-btn {
  flex: 1;
  padding: 1rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  color: #666;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  min-width: 150px;
}

.tab-btn:hover {
  background: #f0f0f0;
  color: #333;
}

.tab-btn.active {
  color: #667eea;
  border-bottom-color: #667eea;
  background: white;
}

.tab-content {
  display: none;
  padding: 2rem;
  animation: fadeIn 0.3s ease;
  background: #ffffff;
  min-height: 400px;
}

.tab-content .card,
.tab-content table,
.tab-content .filter-section,
.tab-content .form-section {
  background-color: #ffffff;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tab-content h2 {
  margin-bottom: 1.5rem;
  color: #333;
  font-size: 1.5rem;
}

.tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.tab-header h2 {
  margin: 0;
}

.tab-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.po-status-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-start;
  margin: 1rem 0 1.5rem 0;
}

.po-summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: #f4f6fb;
  color: #3f4a5a;
  border: 1px solid #e1e6f0;
  white-space: nowrap;
}

.po-summary-chip[data-status="draft"] {
  background: #fff7e6;
  color: #8a5b00;
  border-color: #ffe1a3;
}

.po-summary-chip[data-status="sent"] {
  background: #e9f1ff;
  color: #1f4d99;
  border-color: #bfd4ff;
}

.po-summary-chip[data-status="partial"] {
  background: #fff0f5;
  color: #8a2d57;
  border-color: #ffc3da;
}

.po-summary-chip[data-status="received"] {
  background: #e9f8ef;
  color: #1e6b3d;
  border-color: #bfe8ce;
}

.po-summary-chip[data-status="backorder"] {
  background: #fdecec;
  color: #8c2f2f;
  border-color: #f5bcbc;
}

.po-summary-count {
  font-weight: 700;
}

.form-section, .list-section, .filter-section {
  margin-bottom: 2rem;
}

.form-section h3, .list-section h3, .filter-section h3 {
  margin-bottom: 1rem;
  color: #555;
}

form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  padding: 1.5rem;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-row .form-group {
  margin-bottom: 0;
}

.form-section {
  margin-bottom: 1.5rem;
}

.form-section:last-of-type {
  margin-bottom: 0;
}

.form-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #999;
  margin: 0 0 0.75rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
}

.form-group-search {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  position: relative;
}

.form-group-search input[type="text"] {
  flex: 1;
}

.form-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  border: 1px solid #ddd;
  border-top: none;
  background: white;
  border-radius: 0 0 6px 6px;
  max-height: 200px;
  overflow-y: auto;
  display: none;
  z-index: 1001;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.form-group-new-input {
  display: none;
  margin-top: 0.5rem;
}

.form-hint {
  display: block;
  color: #666;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
}

.form-actions .btn-submit {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  background: #667eea;
  color: white;
  transition: all 0.2s;
}

.form-actions .btn-submit:hover {
  background: #5568d3;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.form-actions .btn-cancel {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  background: white;
  color: #555;
  transition: all 0.2s;
}

.form-actions .btn-cancel:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

.create-user-hint {
  font-size: 0.9rem;
  color: #555;
  margin: 0 0 1rem 0;
  line-height: 1.4;
}

.create-user-success-msg {
  color: #555;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.temporary-password-box {
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1rem;
}

.temporary-password-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: #333;
}

.temporary-password-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.temporary-password-row code {
  flex: 1;
  font-family: ui-monospace, monospace;
  font-size: 1rem;
  padding: 0.5rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  word-break: break-all;
}

.btn-copy-password {
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.btn-copy-password:hover {
  background: #5568d3;
}

.form-group label {
  font-weight: 600;
  color: #333;
  font-size: 0.95rem;
}

input, select, button {
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.3s;
}

input:focus, select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

button:active {
  transform: translateY(0);
}

/* Form buttons */
form button {
  margin-top: 1rem;
  margin-right: 0.5rem;
  padding: 0.75rem 1.5rem;
  min-width: 120px;
}

form button[type="button"] {
  background: #6c757d;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.filter-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid #e9ecef;
}

.filter-bar-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-bar-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.filter-section input[type="text"],
.filter-section input[type="search"] {
  flex: 1;
  min-width: 160px;
  max-width: 280px;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
}

.filter-section input[type="date"] {
  min-width: 140px;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
}

.filter-section select {
  min-width: 140px;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
  background: white;
}

.filter-section label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  font-size: 0.9rem;
  color: #333;
}

.filter-section label input[type="checkbox"] {
  flex: 0;
  min-width: auto;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.filter-section button {
  padding: 0.5rem 1rem;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

.filter-section button:hover {
  background: #764ba2;
}

@media (max-width: 768px) {
  .filter-section input[type="text"],
  .filter-section input[type="search"] {
    max-width: 100%;
    min-width: 100%;
  }
}

#products-list, #parts-list, #suppliers-list, #services-list, #pos-list, #purchase-orders-list, #po-templates-list, #po-backorders-list, #audit-list, #users-list {
  display: grid;
  gap: 1rem;
}

/* Card layout improvements */
.card-header-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.card-header-row h4 {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.card-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: #666;
}

.card-meta span {
  padding: 0.25rem 0.5rem;
  background: #f5f5f5;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
}

.status-badge {
  font-family: inherit !important;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge.status-available {
  background: #d4edda !important;
  color: #155724;
}

.status-badge.status-unavailable {
  background: #f8d7da !important;
  color: #721c24;
}

.status-badge.status-approved {
  background: #cce5ff !important;
  color: #004085;
}

.card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 600px) {
  .card-body {
    grid-template-columns: 1fr;
  }
}

.card-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card-field-group h5 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #999;
  margin: 0 0 0.25rem 0;
}

.stock-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  background: #f8f9fa;
  padding: 0.75rem;
  border-radius: 6px;
  margin-top: 0.5rem;
}

.stock-stats-item {
  text-align: center;
}

.stock-stats-label {
  font-size: 0.75rem;
  color: #666;
  margin-bottom: 0.25rem;
}

.stock-stats-value {
  font-size: 1.25em;
  font-weight: 700;
}

.stock-stats-value.available {
  font-size: 1.4em;
}

.alert-low-stock {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.stock-adjust-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
}

.stock-adjust-box .qty-input {
  margin: 0;
}

.stock-adjust-label {
  font-size: 0.85rem;
  color: #666;
  white-space: nowrap;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.card-actions-primary {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.card-actions-secondary {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn-primary {
  background: #667eea !important;
  color: white !important;
  border-color: #667eea !important;
}

.btn-primary:hover {
  background: #5a67d8 !important;
  border-color: #5a67d8 !important;
}

.btn-accent {
  background: #f39c12 !important;
  color: white !important;
  border-color: #f39c12 !important;
}

.btn-accent:hover {
  background: #e67e22 !important;
  border-color: #e67e22 !important;
}

.parts-section-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #f8f9fa;
  border-radius: 6px;
  border-left: 3px solid #667eea;
  margin: 0.75rem 0;
}

.parts-section-compact h5 {
  margin: 0;
  font-size: 0.9rem;
  color: #555;
}

.parts-section-expanded {
  display: block !important;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 6px;
  border-left: 3px solid #667eea;
  margin: 0.75rem 0;
}

.parts-section-expanded h5 {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  color: #333;
}

.admin-window-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: #fff3cd;
  color: #856404;
  border-bottom: 1px solid #ffeeba;
  font-weight: 600;
}

.admin-window-banner__text {
  font-size: 0.95rem;
}

.admin-window-banner__btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}

.admin-window-banner__btn:hover {
  background: #5a67d8;
}

.card {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.5rem;
  background: white;
  transition: all 0.3s ease;
}

.card.stock-critical {
  border-left: 4px solid #e74c3c;
  background: #fff5f5;
}

.card.stock-warning {
  border-left: 4px solid #f39c12;
  background: #fffbf0;
}

.card.stock-low {
  border-left: 4px solid #e67e22;
  background: #fff8f0;
}

.card.stock-good {
  border-left: 4px solid #27ae60;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: #667eea;
}

.card h4 {
  margin: 0;
  color: #333;
  font-size: 1.1rem;
}

.card-code {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.8rem;
  padding: 0.5rem 0.75rem;
  background: #f5f5f5;
  border-left: 3px solid #667eea;
  border-radius: 4px;
}

.card-code strong {
  color: #667eea;
  font-weight: 600;
  letter-spacing: 1px;
  font-family: 'Courier New', monospace;
}

.card-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.card-field {
  font-size: 0.9rem;
  color: #666;
}

.card-field strong {
  display: block;
  color: #333;
  margin-bottom: 0.25rem;
}

.po-status {
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #f0f0f0;
  color: #555;
}

.po-status.draft { background: #e3f2fd; color: #1565c0; }
.po-status.sent { background: #fff3e0; color: #ef6c00; }
.po-status.confirmed { background: #e8f5e9; color: #2e7d32; }
.po-status.partial { background: #fffde7; color: #f9a825; }
.po-status.received { background: #e8f5e9; color: #2e7d32; }
.po-status.invoiced { background: #ede7f6; color: #6a1b9a; }
.po-status.backorder { background: #ffebee; color: #c62828; }

#po-line-items-container,
#po-template-line-items-container {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.po-line-item {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #f9f9f9;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  width: 100%;
  box-sizing: border-box;
}

.po-line-item-field:nth-child(1) { grid-column: 1; }
.po-line-item-field:nth-child(2) { grid-column: 2; }
.po-line-item-field:nth-child(3) { grid-column: 1; }
.po-line-item-field:nth-child(4) { grid-column: 2; }

.po-line-item-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.po-line-item-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  margin-top: 0.5rem;
}

.po-line-item-field label {
  font-weight: 600;
  font-size: 0.85rem;
  color: #555;
}

.po-line-item select,
.po-line-item input {
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.po-line-item button {
  align-self: flex-end;
  padding: 0.5rem 0.75rem;
  margin-top: 1.25rem;
}

.po-line-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  table-layout: fixed;
}

.po-line-items-table th,
.po-line-items-table td {
  border: 1px solid #eee;
  padding: 0.5rem;
  font-size: 0.9rem;
  word-break: break-word;
  vertical-align: top;
}

.po-line-items-table input,
.po-line-items-table select,
.po-line-items-table textarea {
  width: 100%;
  box-sizing: border-box;
}

.po-line-items-table th:nth-child(1),
.po-line-items-table td:nth-child(1) {
  width: 35%;
  max-width: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.po-line-items-table th:nth-child(2),
.po-line-items-table td:nth-child(2) {
  width: 10%;
}

.po-line-items-table th:nth-child(3),
.po-line-items-table td:nth-child(3) {
  width: 12%;
}

.po-line-items-table th:nth-child(4),
.po-line-items-table td:nth-child(4) {
  width: 12%;
}

.po-line-items-table th:nth-child(5),
.po-line-items-table td:nth-child(5) {
  width: 12%;
}

.po-line-items-table th:nth-child(6),
.po-line-items-table td:nth-child(6) {
  width: 19%;
}

.po-line-items-table--draft th:nth-child(1),
.po-line-items-table--draft td:nth-child(1) {
  width: 105px;
  min-width: 105px;
}

.po-line-items-table--draft th:nth-child(2),
.po-line-items-table--draft td:nth-child(2) {
  width: 40%;
  min-width: 260px;
}

.po-line-items-table--draft th:nth-child(4),
.po-line-items-table--draft td:nth-child(4) {
  width: 110px;
  min-width: 110px;
}

.po-line-items-table--draft th:nth-child(6),
.po-line-items-table--draft td:nth-child(6) {
  width: 130px;
  min-width: 130px;
}

#po-detail-content {
  overflow-x: hidden;
  min-width: 0;
}

.po-line-items-table input,
.po-line-items-table select,
.po-detail-header input,
.po-detail-header textarea {
  padding: 0.4rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
}

.po-detail-header textarea {
  width: 100%;
  min-height: 60px;
}

.po-detail-header {
  margin-bottom: 1rem;
}

.po-history-list {
  display: grid;
  gap: 0.5rem;
}

.po-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem;
  border: 1px solid #eee;
  border-radius: 6px;
  background: #fafafa;
}

#po-templates-list .card-actions,
#po-backorders-list .card-actions {
  justify-content: flex-start;
}

.parts-section {
  margin: 1rem 0;
  padding: 1rem;
  background: #f0f0f0;
  border-radius: 6px;
  border-left: 4px solid #667eea;
}

.parts-section h5 {
  margin: 0 0 0.5rem 0;
  color: #333;
  font-size: 0.95rem;
}

.stock-adjust-controls {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.qty-input {
  width: 60px;
  padding: 0.5rem;
  font-size: 0.9rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-align: center;
  font-weight: 500;
}

.qty-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.btn-stock {
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
  min-width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-stock.btn-add {
  background: #27ae60;
  color: white;
}

.btn-stock.btn-add:hover {
  background: #229954;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
}

.btn-stock.btn-remove {
  background: #e74c3c;
  color: white;
}

.btn-stock.btn-remove:hover {
  background: #c0392b;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.adjustment-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
  gap: 0.5rem;
  flex: 1;
  min-width: 300px;
}

.btn-adjust {
  padding: 0.5rem;
  font-size: 0.85rem;
  border: 1px solid #667eea;
  background: white;
  color: #667eea;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-adjust:hover {
  background: #667eea;
  color: white;
}

.btn-adjust-sm {
  padding: 0.35rem;
  font-size: 0.8rem;
  min-width: 45px;
}

.custom-quantity {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.custom-quantity input {
  width: 100px;
  padding: 0.5rem;
  font-size: 0.9rem;
  border: 1px solid #ddd;
  border-radius: 6px;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  border: 1px solid #ddd;
  background: white;
  color: #667eea;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-small:hover {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.btn-icon {
  padding: 0.4rem 0.6rem;
  font-size: 1rem;
  min-width: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.status-pending {
  background: #fff3cd;
  color: #856404;
}

.status-approved {
  background: #d4edda;
  color: #155724;
}

.status-shipped {
  background: #d1ecf1;
  color: #0c5460;
}

.status-received {
  background: #d4edda;
  color: #155724;
}

.alert-low-stock {
  background: #f8d7da;
  color: #721c24;
  padding: 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #999;
}

.empty-state p {
  font-size: 1.1rem;
}
.btn-danger {
  color: #dc3545;
  border-color: #dc3545;
}

.btn-danger:hover {
  background: #dc3545 !important;
  color: white !important;
  border-color: #dc3545 !important;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.modal-content {
  background-color: white;
  margin: 3% auto;
  padding: 2rem;
  border-radius: 12px;
  max-width: 640px;
  max-height: 88vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
  margin-bottom: 1.5rem;
  color: #333;
  font-size: 1.25rem;
}

.close-modal {
  color: #aaa;
  float: right;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}

.close-modal:hover,
.close-modal:focus {
  color: #000;
}


.btn-create {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  border: none;
  background: #667eea;
  color: white;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
  flex-shrink: 0;
}

.btn-create:hover {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#create-product-form,
#create-part-form,
#create-supplier-form,
#create-service-form,
#create-po-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

#create-product-form .form-actions,
#create-part-form .form-actions,
#create-supplier-form .form-actions,
#create-service-form .form-actions {
  margin-top: 1.5rem;
}

#create-po-form .po-action-btn {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  background: #667eea;
  color: white;
}

#create-po-form .po-action-btn:hover {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#edit-product-form button,
#edit-part-form button,
#edit-supplier-form button,
#edit-service-form button {
  padding: 0.75rem;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

#edit-product-form button[type="submit"],
#edit-part-form button[type="submit"],
#edit-supplier-form button[type="submit"],
#edit-service-form button[type="submit"] {
  background: #667eea;
  color: white;
}

#edit-product-form button[type="submit"]:hover,
#edit-part-form button[type="submit"]:hover,
#edit-supplier-form button[type="submit"]:hover,
#edit-service-form button[type="submit"]:hover {
  background: #5568d3;
}

#edit-product-form button[type="button"],
#edit-part-form button[type="button"],
#edit-supplier-form button[type="button"],
#edit-service-form button[type="button"] {
  background: #e0e0e0;
  color: #333;
}

#edit-product-form button[type="button"]:hover,
#edit-part-form button[type="button"]:hover,
#edit-supplier-form button[type="button"]:hover,
#edit-service-form button[type="button"]:hover {
  background: #d0d0d0;
}

/* Pagination Styles */
.pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding: 1.5rem;
  border-top: 2px solid #e0e0e0;
  background: #f9f9f9;
  border-radius: 0 0 8px 8px;
  flex-wrap: wrap;
  gap: 1rem;
}

.pagination-info {
  color: #666;
  font-size: 0.95rem;
  font-weight: 500;
}

.pagination-perpage {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.pagination-perpage label {
  color: #666;
  font-weight: 500;
}

.pagination-controls {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.pagination-controls .btn-small {
  min-width: 40px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
}

.pagination-controls .btn-small.active {
  background: #667eea;
  color: white;
  font-weight: 600;
}

.pagination-controls .btn-small:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .pagination-container {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .pagination-info,
  .pagination-perpage {
    text-align: center;
    justify-content: center;
  }
  
  .pagination-controls {
    justify-content: center;
  }
}

/* Searchable Select Styles */
.searchable-select-wrapper {
  position: relative;
  width: 100%;
  overflow: visible;
}

.searchable-select-wrapper input[type="text"] {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  cursor: text;
}

.searchable-select-wrapper input[type="text"]:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.searchable-select-dropdown {
  position: fixed;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  max-height: 250px;
  overflow-y: auto;
  z-index: 10000;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  min-width: 250px;
}

.searchable-select-item {
  padding: 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.2s;
}

.searchable-select-item:last-child {
  border-bottom: none;
}

.searchable-select-item:hover {
  background: #f5f7ff;
}

.searchable-select-item strong {
  color: #667eea;
}

#production-product-search {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  cursor: text;
}

#production-product-search:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

/* Specifications Modal Styles */
.modal-large {
  max-width: 800px !important;
  max-height: 85vh;
  overflow-y: auto;
}

.spec-category-info {
  padding: 0.75rem;
  background: #f5f7ff;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  color: #667eea;
}

.spec-fields-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.spec-field {
  display: flex;
  flex-direction: column;
}

.spec-field label {
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #333;
}

.spec-field input {
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.spec-field input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.spec-custom-section {
  border-top: 2px solid #e0e0e0;
  padding-top: 1.5rem;
  margin-top: 1.5rem;
}

.spec-custom-section h4 {
  margin-bottom: 1rem;
  color: #333;
}

#custom-spec-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.spec-custom-field {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.75rem;
  align-items: center;
}

.spec-custom-field input {
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
}

.spec-custom-field input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.specs-summary {
  font-size: 0.95rem;
  color: #555;
  background: #f8f9fa;
  padding: 0.5rem;
  border-radius: 4px;
  border-left: 3px solid #667eea;
  transition: all 0.2s ease;
}

.specs-summary:hover {
  background: #e7e9ff;
  border-left-color: #764ba2;
  transform: translateX(2px);
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid #e0e0e0;
}

/* Audit Logs */
.audit-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.audit-badge-create {
  background: #d4edda;
  color: #155724;
}

.audit-badge-update {
  background: #cce5ff;
  color: #004085;
}

.audit-badge-delete {
  background: #f8d7da;
  color: #721c24;
}

.audit-badge-other {
  background: #e2e3e5;
  color: #383d41;
}

.audit-card .audit-card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.audit-card .audit-entity {
  font-size: 0.95rem;
  color: #555;
}

.audit-summary {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  color: #333;
}

.audit-changes {
  font-size: 0.9rem;
  background: #f8f9fa;
  padding: 0.75rem;
  border-radius: 6px;
  border-left: 3px solid #667eea;
}

.audit-kv, .audit-diff-row {
  margin-bottom: 0.25rem;
}

.audit-k {
  color: #666;
  font-weight: 500;
  margin-right: 0.25rem;
}

.audit-v {
  color: #333;
}

.audit-old {
  color: #721c24;
  text-decoration: line-through;
}

.audit-new {
  color: #155724;
  font-weight: 500;
}

.audit-raw {
  font-family: monospace;
  font-size: 0.85rem;
  word-break: break-all;
}
