:root {
  --bg: #f4f7fc;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-soft: #475569;
  --line: #dbe7ff;
  --brand: #2563eb;
  --brand-strong: #1e40af;
  --brand-soft: #e9f0ff;
}

body {
  background:
    radial-gradient(1200px 500px at -10% -20%, #dfe9ff 0%, transparent 60%),
    radial-gradient(900px 400px at 110% 0%, #e6efff 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  font-family: "Segoe UI", "Inter", "Plus Jakarta Sans", sans-serif;
}

.topbar {
  background: linear-gradient(130deg, #1d4ed8, #2563eb 45%, #3b82f6);
  color: #eff6ff;
  border-bottom: 1px solid #93c5fd55;
}

.nav-pills .nav-link {
  color: #334155;
  border-radius: 10px;
  font-weight: 600;
}

.nav-pills .nav-link.active {
  background-color: var(--brand);
  box-shadow: 0 6px 14px #2563eb33;
}

.kpi-card {
  border: 1px solid var(--line);
  background: #ffffffd9;
  backdrop-filter: blur(3px);
}

.fade-in {
  animation: fadeIn 220ms ease-out;
}

.btn-primary {
  background-color: var(--brand);
  border-color: var(--brand);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--brand-strong);
  border-color: var(--brand-strong);
}

.app-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 30px #0f172a0f;
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 14px;
}

.metric-card small {
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
}

.metric-card p {
  margin: 8px 0 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.product-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}

.product-thumb-wrap {
  border-bottom: 1px solid var(--line);
}

.product-thumb {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

.product-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  background: linear-gradient(145deg, #eef4ff, #f8fbff);
}

.product-body {
  padding: 12px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--ink-soft);
  padding: 20px;
  text-align: center;
  background: #f8fbff;
}

.form-control,
.form-select {
  border-color: #cfdfff;
}

.form-control:focus,
.form-select:focus {
  border-color: #90b5ff;
  box-shadow: 0 0 0 0.25rem #3b82f620;
}

.view-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.view-switch-btn {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 12px;
  background: #f8fbff;
  border-right: 1px solid var(--line);
}

.view-switch-btn:last-child {
  border-right: 0;
}

.view-switch-btn.active {
  color: #fff;
  background: var(--brand);
}

.modern-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  border-bottom-color: var(--line);
}

.modern-table td {
  border-color: var(--line);
}

.product-thumb-mini {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.picker-modal[hidden] {
  display: none;
}

.picker-modal {
  position: fixed;
  inset: 0;
  z-index: 1060;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.picker-modal-backdrop {
  position: absolute;
  inset: 0;
  background: #0f172a99;
}

.picker-modal-panel {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  overflow: auto;
  background: var(--surface);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  border: 1px solid var(--line);
  padding: 14px;
}

.picker-products-grid {
  padding-bottom: 8px;
}

.picker-product-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0;
  overflow: hidden;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.picker-product-card:active {
  transform: scale(0.98);
}

.picker-product-card:hover {
  box-shadow: 0 8px 18px #0f172a14;
}

.picker-product-image-wrap {
  border-bottom: 1px solid var(--line);
}

.picker-product-image {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.picker-product-image-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  background: linear-gradient(145deg, #eef4ff, #f8fbff);
}

.picker-product-body {
  padding: 10px;
}

body.picker-modal-open {
  overflow: hidden;
}

.users-history-toolbar {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.users-filter-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.users-filter-item {
  display: grid;
  gap: 4px;
  min-width: 190px;
}

.users-filter-item-user {
  min-width: 230px;
}

.users-filter-actions {
  display: flex;
  gap: 8px;
}

@media (max-width: 992px) {
  .users-history-toolbar {
    width: 100%;
    justify-content: flex-start;
  }

  .users-filter-form {
    width: 100%;
    justify-content: flex-start;
  }

  .users-filter-item {
    min-width: 0;
    flex: 1 1 220px;
  }
}

@media (min-width: 768px) {
  .picker-modal {
    align-items: center;
  }

  .picker-modal-panel {
    border-radius: 16px;
  }
}

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