*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--sv-font-sans, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif);
  background: var(--sv-color-surface, #eef2f7);
  color: var(--sv-color-ink, #1f2933);
  line-height: 1.5;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: #1e293b;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-brand {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
}

.nav-links {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.nav-link {
  color: #cbd5e1;
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.95rem;
  transition: background 0.2s, color 0.2s;
}

.nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
  color: #fff;
  background: var(--sv-color-primary, #2563eb);
}

.nav-btn {
  border: none;
  cursor: pointer;
  font: inherit;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-container {
  width: 100%;
  max-width: 420px;
}

.login-card {
  margin-bottom: 0;
}

.login-header {
  text-align: center;
  margin-bottom: 1.25rem;
}

.login-header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
}

.login-header p {
  margin: 0;
  color: #64748b;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

.container-wide {
  max-width: 1200px;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin: 0 0 0.25rem;
  font-size: 2rem;
}

.page-header p {
  margin: 0;
  color: #52606d;
}

.card {
  background: #fff;
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  border: 1px solid #e2e8f0;
}

.card h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

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

.btn-secondary {
  background: #e2e8f0;
  color: #1e293b;
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.loading-state {
  text-align: center;
  padding: 2rem 1rem;
  color: #64748b;
}

.section-heading h2 {
  margin-bottom: 0;
}

.summary-text {
  margin: 0;
  color: #64748b;
  font-size: 0.95rem;
}

.search-form {
  display: flex;
  gap: 0.75rem;
}

.search-form input {
  flex: 1;
  margin-bottom: 0;
}

.input-prefix-group {
  display: flex;
  align-items: stretch;
  margin-bottom: 0.75rem;
}

.input-prefix-group input {
  margin-bottom: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  flex: 1;
}

.input-prefix {
  display: inline-flex;
  align-items: center;
  padding: 0.65rem 0.75rem;
  background: #e2e8f0;
  border: 1px solid #cbd5e9;
  border-right: none;
  border-radius: 8px 0 0 8px;
  color: #475569;
  font-weight: 600;
  white-space: nowrap;
}

.control-group-search .input-prefix-group {
  margin-bottom: 0;
}

.table-controls {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 1rem;
  margin-bottom: 1.25rem;
  align-items: end;
}

.control-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.35rem;
}

.control-group input,
.control-group select {
  margin-bottom: 0;
}

.control-group-action button {
  width: 100%;
}

.table-wrapper {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.inventory-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.inventory-table thead {
  background: #f1f5f9;
}

.inventory-table th,
.inventory-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.inventory-table tbody tr:hover {
  background: #f8fafc;
}

.inventory-table tbody tr:last-child td {
  border-bottom: none;
}

.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
  background: none;
  color: #1e293b;
  font-weight: 700;
  font-size: 0.9rem;
}

.sort-btn:hover,
.sort-btn.active {
  background: none;
  color: #2563eb;
}

.sort-indicator {
  font-size: 0.75rem;
  color: #2563eb;
  min-width: 0.75rem;
}

.table-message {
  text-align: center;
  color: #64748b;
  padding: 2rem 1rem !important;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid #cbd5e9;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

button {
  padding: 0.65rem 1rem;
  border: none;
  border-radius: var(--sv-radius-sm, 8px);
  background: var(--sv-color-primary, #2563eb);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background: var(--sv-color-primary-hover, #1d4ed8);
}

.search-result {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  background: linear-gradient(135deg, #eff6ff, #f0fdf4);
  border-radius: 10px;
  border: 1px solid #bfdbfe;
}

.location-breadcrumb {
  font-weight: 600;
  color: #1e40af;
  margin: 0.35rem 0 0;
}

.error-message {
  color: #b91c1c;
  margin-top: 0.75rem;
}

.form-message {
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

.form-message.success {
  color: #047857;
}

.form-message.error {
  color: #b91c1c;
}

.grid.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.form-block h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.mode-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.mode-btn {
  background: #e4e7eb;
  color: #1f2933;
}

.mode-btn.active {
  background: var(--sv-color-primary, #2563eb);
  color: #fff;
}

.warehouse-map {
  display: grid;
  gap: 1.5rem;
}

.unit-card {
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  border: 2px solid #cbd5e1;
  border-radius: 16px;
  overflow: hidden;
}

.unit-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: #1e293b;
  color: #fff;
}

.unit-card-header h3 {
  margin: 0;
  font-size: 1.15rem;
}

.unit-card-header p {
  margin: 0.15rem 0 0;
  color: #cbd5e1;
  font-size: 0.9rem;
}

.unit-badge {
  width: 3rem;
  height: 3rem;
  border-radius: 12px;
  background: #2563eb;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.box-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  padding: 1.25rem;
}

.box-card {
  background: #fff;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
  min-height: 140px;
  display: flex;
  flex-direction: column;
}

.box-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: #eff6ff;
  border-bottom: 1px solid #dbeafe;
}

.box-card-header h4 {
  margin: 0;
  font-size: 1rem;
  color: #1e40af;
}

.box-card-header p {
  margin: 0.1rem 0 0;
  font-size: 0.82rem;
  color: #64748b;
}

.box-icon {
  font-size: 1.35rem;
}

.box-contents {
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
}

.product-chip {
  display: grid;
  gap: 0.1rem;
  padding: 0.65rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #2563eb;
  border-radius: 8px;
}

.product-chip-sku {
  font-weight: 700;
  font-size: 0.82rem;
  color: #1e40af;
  letter-spacing: 0.02em;
}

.product-chip-name {
  font-size: 0.92rem;
  color: #1f2933;
}

.product-chip-size {
  font-size: 0.8rem;
  color: #64748b;
}

.box-empty,
.unit-empty {
  display: grid;
  place-items: center;
  text-align: center;
  color: #94a3b8;
  font-size: 0.9rem;
  padding: 1rem;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  min-height: 80px;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: #64748b;
}

.text-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.text-link:hover {
  text-decoration: underline;
}

.hidden {
  display: none;
}

@media (max-width: 720px) {
  .grid.two-col {
    grid-template-columns: 1fr;
  }

  .search-form {
    flex-direction: column;
  }

  .table-controls {
    grid-template-columns: 1fr;
  }

  .site-nav {
    flex-direction: column;
    align-items: flex-start;
  }
}
