* {
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  margin: 0;
  background: #f2fbf5;
  color: #1f2937;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  position: sticky;
  top: 0;
  height: 100vh;
  align-self: flex-start;
  overflow-y: auto;
  background: linear-gradient(180deg, #0f5132 0%, #166534 100%);
  color: #ecfdf3;
  padding: 28px 18px;
}

.sidebar h2 {
  margin: 0 0 18px 0;
  font-size: 24px;
  letter-spacing: 0.3px;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar a {
  color: #e7f9ed;
  text-decoration: none;
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.2s ease, transform 0.2s ease;
}

.sidebar a:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateX(2px);
}

.sidebar a.sidebar-logout {
  margin-top: 10px;
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.sidebar a.sidebar-logout:hover {
  background: #bbf7d0;
}

.main {
  flex: 1;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.menu-toggle {
  display: none;
}

.user-badge {
  background: #14532d;
  color: #ffffff;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid #166534;
}

.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.auth-card {
  background: #ffffff;
  border-radius: 10px;
  width: 360px;
  padding: 24px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}

form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

input,
select,
textarea,
button {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
}

button,
.button-link {
  border: none;
  background: #16a34a;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.button-link {
  padding: 10px 12px;
  border-radius: 6px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  margin-top: 12px;
  border: 1px solid #d1e7d8;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(15, 81, 50, 0.06);
}

th,
td {
  border-bottom: 1px solid #e8f2eb;
  padding: 10px;
  text-align: left;
}

th {
  background: #f0fdf4;
  color: #14532d;
  font-weight: 700;
}

tbody tr:hover {
  background: #f8fffa;
}

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

.cards {
  display: flex;
  gap: 12px;
}

.card {
  background: #fff;
  padding: 16px;
  border-radius: 8px;
  min-width: 200px;
}

.detail-grid {
  margin-top: 12px;
  margin-bottom: 16px;
}

.payload-box {
  background: #14532d;
  color: #dcfce7;
  padding: 12px;
  border-radius: 8px;
  overflow: auto;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.alerts {
  padding: 0;
  list-style: none;
}

.alert {
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.alert.error {
  background: #fee2e2;
  color: #991b1b;
}

.alert.success {
  background: #dcfce7;
  color: #166534;
}

.muted {
  color: #6b7280;
  font-size: 14px;
}

.actions-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stream-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stream-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px;
  display: grid;
  grid-template-columns: 1.3fr 1.2fr auto;
  gap: 16px;
  align-items: start;
}

.stream-card h3 {
  margin: 0 0 8px 0;
}

.stream-card p {
  margin: 0 0 6px 0;
  word-break: break-word;
}

.stream-card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.danger-btn {
  background: #dc2626;
}

.pagination-bar {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.line-image {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #d1d5db;
}

.payload-details summary {
  cursor: pointer;
  font-weight: 700;
  color: #14532d;
  margin-bottom: 8px;
}

.cell-subtle {
  color: #6b7280;
  font-size: 12px;
}

.detail-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.btn-compact {
  width: fit-content;
  padding: 7px 12px;
  font-size: 13px;
}

.badge {
  display: inline-block;
  margin-top: 4px;
  margin-right: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-pim {
  background: #dcfce7;
  color: #166534;
}

.badge-ok {
  background: #bbf7d0;
  color: #166534;
}

.badge-warn {
  background: #fef3c7;
  color: #92400e;
}

.badge-muted {
  background: #e5e7eb;
  color: #4b5563;
}

.sync-badge {
  margin-top: 0;
  font-size: 13px;
  padding: 6px 10px;
}

.sync-debug-modal {
  width: min(920px, 92vw);
  border: 1px solid #d1e7d8;
  border-radius: 12px;
  padding: 14px;
}

.sync-debug-modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.sync-debug-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.top-products-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.top-product-card {
  min-width: 0;
}

.top-product-image {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  margin-bottom: 8px;
}

.top-product-image-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0fdf4;
  color: #14532d;
  font-size: 12px;
}

.orders-filters-row {
  display: flex !important;
  flex-direction: row !important;
  justify-content: flex-start !important;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
  width: auto;
}

.orders-filters-row select,
.orders-filters-row input {
  width: 260px;
  max-width: 260px;
  margin: 0;
}

@media (max-width: 768px) {
  .layout {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 250px;
    height: 100vh;
    z-index: 1100;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar-backdrop {
    display: none;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 1000;
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    font-size: 22px;
    line-height: 1;
    padding: 0;
  }

  .main {
    padding: 14px;
  }

  .topbar {
    justify-content: space-between;
    align-items: center;
    gap: 6px;
  }

  .user-badge {
    font-size: 12px;
    padding: 6px 10px;
  }

  .header-row {
    gap: 8px;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .detail-columns {
    grid-template-columns: 1fr;
  }

  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }

  th,
  td {
    font-size: 13px;
    padding: 8px;
  }

  .line-image {
    width: 44px;
    height: 44px;
  }

  .orders-filters-row {
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .orders-filters-row select,
  .orders-filters-row input {
    width: 220px;
    max-width: 220px;
  }

  .top-products-grid {
    grid-template-columns: 1fr 1fr;
  }

  .mobile-hide {
    display: none;
  }
}
