/* ─── Map, availability table, filters, badges, state banners ─── */

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(560px, 0.92fr);
  gap: 18px;
  padding: 20px 0 24px;
  align-items: stretch;
}

.dashboard > * {
  min-width: 0;
}

.map-card {
  min-height: clamp(320px, 38vh, 480px);
  position: relative;
  overflow: hidden;
}

.map-frame {
  position: absolute;
  inset: 0;
}

#leaflet-map {
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* Map summary inner layout — display:contents lets children be direct grid items on desktop */
.map-summary-info {
  display: contents;
}

.map-summary-count {
  display: contents;
}

.map-open-btn {
  display: none;
}

.map-summary {
  position: absolute;
  left: 22px;
  top: 22px;
  z-index: 2;
  width: 178px;
  display: grid;
  gap: 8px;
  padding: 20px;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 35px rgba(20, 52, 96, 0.16);
}

.map-summary strong {
  color: #0ca99b;
  font-size: 2.25rem;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.map-summary span {
  font-weight: 800;
}

.map-summary small {
  color: var(--muted);
  font-weight: 650;
}

.panel {
  padding: 22px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head.compact {
  align-items: start;
}

.list-controls {
  display: grid;
  grid-template-columns: minmax(120px, 0.85fr) minmax(120px, 0.95fr) minmax(100px, 0.7fr) minmax(150px, 1.05fr);
  gap: 10px;
  align-items: end;
  margin: 0 0 16px;
}

.list-controls label {
  gap: 6px;
}

.check-control {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  color: var(--text);
}

.check-control input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
}

.availability {
  display: flex;
  flex-direction: column;
  max-height: clamp(320px, 38vh, 480px);
  overflow: hidden;
}

.availability .table-wrap {
  flex: 1;
}

/* ─── Stock table ─── */

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
}

th:nth-child(1),
td:nth-child(1) {
  width: 18%;
}

th:nth-child(2),
td:nth-child(2) {
  width: 22%;
}

th:nth-child(3),
td:nth-child(3) {
  width: 12%;
}

th:nth-child(4),
td:nth-child(4) {
  width: 16%;
}

th:nth-child(5),
td:nth-child(5) {
  width: 16%;
}

th:nth-child(6),
td:nth-child(6) {
  width: 16%;
}

th,
td {
  padding: 13px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
}

td {
  font-weight: 700;
}

/* ─── Stock badges ─── */

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
}

.badge.stock {
  background: color-mix(in srgb, var(--success) 18%, transparent);
  color: var(--success);
}

.badge.low {
  background: rgba(216, 108, 0, 0.15);
  color: var(--warning);
}

.badge.out {
  background: rgba(216, 60, 60, 0.12);
  color: #c03030;
}

/* ─── State banners ─── */

.state-banner,
.empty-state {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 750;
}

.state-banner.loading {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.state-banner.error {
  background: rgba(216, 108, 0, 0.13);
}

.empty-state {
  display: grid;
  gap: 4px;
  background: var(--surface-soft);
}
