/* ── Browse Layout ────────────────────────────────────────────────────────────── */
.browse-wrap {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  min-height: calc(100vh - var(--nav-h));
  align-items: start;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────────── */
.browse-sidebar {
  background: #ffffff;
  border-right: 1px solid var(--border);
  box-shadow: 2px 0 12px rgba(0,0,0,.05);
  padding: var(--sp-6);
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-5);
}
.sidebar-title {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--text);
}
.sidebar-reset {
  background: none;
  border: none;
  font-size: .8rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r-sm);
}
.sidebar-reset:hover { background: var(--primary-light); }

.filter-group { margin-bottom: var(--sp-5); }
.filter-label {
  display: block;
  font-size: .775rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: var(--sp-2);
}
.filter-select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-size: .875rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  transition: border-color .15s;
}
.filter-select:focus { outline: none; border-color: var(--primary); }

.range-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.filter-input {
  flex: 1;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: .875rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s;
  min-width: 0;
}
.filter-input:focus { outline: none; border-color: var(--primary); }
.range-sep { color: var(--text-muted); font-size: .875rem; flex-shrink: 0; }

/* Cargo chips */
.cargo-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip-toggle {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: .775rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
  background: var(--surface);
}
.chip-toggle input { display: none; }
.chip-toggle:hover { border-color: var(--primary); color: var(--primary); }
.chip-toggle.checked {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.browse-search-btn {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: var(--sp-3);
  font-size: .9375rem;
  font-weight: 600;
}
.sidebar-hint {
  margin-top: var(--sp-3);
  font-size: .775rem;
  color: var(--text-light);
  text-align: center;
}

/* ── Main area ────────────────────────────────────────────────────────────────── */
.browse-main {
  background: #ffffff;
  padding: var(--sp-6);
  min-height: calc(100vh - var(--nav-h));
}

.browse-results-hd {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  min-height: 28px;
}
.browse-count-text { font-size: .9rem; color: var(--text-muted); }
.browse-count-text strong { color: var(--text); }

.source-badge {
  font-size: .7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--r-full);
  letter-spacing: .03em;
  text-transform: uppercase;
}
.source-live  { background: #fde8e8; color: #94272a; }
.source-cache { background: #f0fdf4; color: #16a34a; }

/* ── Cards grid ───────────────────────────────────────────────────────────────── */
.browse-grid-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-4);
}

/* ── Carrier card ─────────────────────────────────────────────────────────────── */
.browse-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  cursor: pointer;
  transition: all .2s ease;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.browse-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.bc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
}
.bc-name {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  flex: 1;
}

.bc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.bc-meta-item { display: flex; flex-direction: column; gap: 1px; }
.bc-meta-lbl { font-size: .7rem; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: .04em; }
.bc-meta-val { font-size: .8rem; font-weight: 600; color: var(--text); }

.bc-cargo {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 22px;
}
.bc-cargo-chip {
  font-size: .7rem;
  font-weight: 500;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 2px 9px;
}
.bc-no-cargo { font-size: .75rem; color: var(--text-light); font-style: italic; }

.bc-footer {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: auto;
  padding-top: var(--sp-2);
  border-top: 1px solid var(--border);
}
.bc-auth {
  font-size: .72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--r-full);
  letter-spacing: .03em;
  text-transform: uppercase;
}
.bc-auth.auth-active   { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.bc-auth.auth-revoked  { background: #fff1f2; color: #b91c1c; border: 1px solid #fca5a5; }
.bc-auth.auth-inactive { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }

.bc-ins-badge {
  font-size: .72rem;
  font-weight: 600;
  background: #fde8e8;
  color: #94272a;
  border: 1px solid #fca5a5;
  border-radius: var(--r-full);
  padding: 3px 10px;
}
.bc-view {
  margin-left: auto;
  font-size: .8rem;
  font-weight: 600;
  color: var(--primary);
}

/* Skeleton */
.browse-card--skeleton { pointer-events: none; }
.sk-line {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* Empty state */
.browse-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}
.browse-empty svg { margin: 0 auto 16px; opacity: .4; }
.browse-empty h3 { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.browse-empty p  { font-size: .875rem; max-width: 360px; margin: 0 auto; }

/* Pagination */
.browse-pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--sp-8);
  flex-wrap: wrap;
}

/* Mobile filter toggle */
.filter-toggle-mobile {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 16px;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: var(--sp-4);
}

/* ── Responsive ───────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .browse-wrap { grid-template-columns: 1fr; }

  .browse-sidebar {
    position: fixed;
    top: 0; left: -100%;
    width: 300px;
    height: 100vh;
    z-index: 200;
    transition: left .3s ease;
    box-shadow: var(--shadow-lg);
    padding-top: calc(var(--nav-h) + 16px);
  }
  .browse-sidebar.open { left: 0; }
  .filter-toggle-mobile { display: flex; }
}

@media (max-width: 600px) {
  .browse-main { padding: var(--sp-4); }
  .browse-grid-inner { grid-template-columns: 1fr; }
}
