@import "tailwindcss";

/* ===== Design Tokens ===== */
:root {
  /* Color palette - Dark teal/cyan theme */
  --color-bg-primary: #0a0f1a;
  --color-bg-secondary: #111827;
  --color-bg-card: #1a2235;
  --color-bg-card-hover: #1f2a42;
  --color-bg-glass: rgba(26, 34, 53, 0.8);
  --color-bg-input: #141c2e;

  --color-accent: #06b6d4;
  --color-accent-hover: #22d3ee;
  --color-accent-muted: rgba(6, 182, 212, 0.15);
  --color-accent-glow: rgba(6, 182, 212, 0.3);

  --color-success: #34d399;
  --color-warning: #fbbf24;
  --color-error: #f87171;

  --color-text-primary: #f1f5f9;
  --color-text-secondary: #94a3b8;
  --color-text-muted: #64748b;

  --color-border: #1e293b;
  --color-border-hover: #334155;
  --color-border-accent: rgba(6, 182, 212, 0.3);

  /* Spacing */
  --sidebar-width: 380px;
  --header-height: 56px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(6, 182, 212, 0.15);
  --shadow-dropdown: 0 8px 32px rgba(0, 0, 0, 0.5);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Base ===== */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--color-border-hover);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* ===== Layout ===== */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.app-header {
  height: var(--header-height);
  background: var(--color-bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  z-index: 50;
  flex-shrink: 0;
}

.app-header__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.app-header__logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--color-accent), #8b5cf6);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.app-header__subtitle {
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 400;
  margin-left: 4px;
}

.app-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-bg-secondary);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar__content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar__footer {
  padding: 16px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
}

/* ===== Map Container ===== */
.map-container {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.map-container .maplibregl-map {
  width: 100%;
  height: 100%;
}

/* ===== Cards / Panels ===== */
.panel {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.panel:hover {
  border-color: var(--color-border-hover);
}

.panel--active {
  border-color: var(--color-border-accent);
  box-shadow: var(--shadow-glow);
}

.panel__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
}

.panel__header:hover {
  background: var(--color-bg-card-hover);
}

.panel__header-icon {
  width: 32px;
  height: 32px;
  background: var(--color-accent-muted);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
  flex-shrink: 0;
}

.panel__header-text {
  flex: 1;
  min-width: 0;
}

.panel__title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel__subtitle {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel__chevron {
  color: var(--color-text-muted);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.panel__chevron--open {
  transform: rotate(180deg);
}

.panel__body {
  padding: 0 16px 16px;
  animation: slideDown var(--transition-normal) ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Form Elements ===== */
.form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-select:hover {
  border-color: var(--color-border-hover);
}

.form-select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-muted);
}

/* ===== Checkbox List ===== */
.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 240px;
  overflow-y: auto;
  margin-top: 10px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  font-size: 13px;
}

.checkbox-item:hover {
  background: var(--color-bg-card-hover);
}

.checkbox-item input[type="checkbox"] {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--color-border-hover);
  border-radius: 4px;
  background: var(--color-bg-input);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  position: relative;
}

.checkbox-item input[type="checkbox"]:checked {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.checkbox-item input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 5px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-item__label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.checkbox-item__value {
  color: var(--color-text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  background: linear-gradient(135deg, var(--color-accent), #0891b2);
  color: white;
  box-shadow: 0 2px 12px rgba(6, 182, 212, 0.3);
}

.btn--primary:hover:not(:disabled) {
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.4);
  transform: translateY(-1px);
}

.btn--primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn--secondary {
  background: var(--color-bg-card);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}

.btn--secondary:hover:not(:disabled) {
  background: var(--color-bg-card-hover);
  border-color: var(--color-border-hover);
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-secondary);
  padding: 8px 12px;
}

.btn--ghost:hover:not(:disabled) {
  background: var(--color-accent-muted);
  color: var(--color-accent);
}

.btn--full {
  width: 100%;
}

.btn--sm {
  padding: 6px 12px;
  font-size: 13px;
}

/* ===== Badge ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge--accent {
  background: var(--color-accent-muted);
  color: var(--color-accent);
}

.badge--success {
  background: rgba(52, 211, 153, 0.15);
  color: var(--color-success);
}

.badge--warning {
  background: rgba(251, 191, 36, 0.15);
  color: var(--color-warning);
}

/* ===== Column Counter ===== */
.column-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--color-text-secondary);
}

.column-counter__bar {
  flex: 1;
  height: 4px;
  background: var(--color-bg-input);
  border-radius: 2px;
  overflow: hidden;
}

.column-counter__fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: 2px;
  transition: width var(--transition-normal);
}

.column-counter__fill--warning {
  background: var(--color-warning);
}

.column-counter__fill--error {
  background: var(--color-error);
}

/* ===== Metadata Panel ===== */
.metadata-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.metadata-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.metadata-item__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.metadata-item__value {
  font-size: 13px;
  color: var(--color-text-primary);
  line-height: 1.5;
}

.metadata-item__value a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.metadata-item__value a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

/* ===== Map Legend ===== */
.map-legend {
  position: absolute;
  bottom: 24px;
  right: 24px;
  background: var(--color-bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  min-width: 180px;
  box-shadow: var(--shadow-card);
  z-index: 10;
}

.map-legend__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 10px;
}

.map-legend__items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.map-legend__item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.map-legend__color {
  width: 16px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ===== Tooltip on map ===== */
.map-tooltip {
  background: var(--color-bg-glass) !important;
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius-md) !important;
  padding: 10px 14px !important;
  box-shadow: var(--shadow-card) !important;
  color: var(--color-text-primary) !important;
  font-family: "Inter", sans-serif !important;
  font-size: 13px !important;
  max-width: 280px !important;
}

.map-tooltip__title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
}

.map-tooltip__row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 0;
}

.map-tooltip__label {
  color: var(--color-text-muted);
}

.map-tooltip__value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ===== Loading / Skeleton ===== */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-bg-card) 25%,
    var(--color-bg-card-hover) 50%,
    var(--color-bg-card) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ===== Empty State ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  text-align: center;
  color: var(--color-text-muted);
}

.empty-state__icon {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state__text {
  font-size: 13px;
  line-height: 1.6;
}

/* ===== Radio Group (Export Format) ===== */
.radio-group {
  display: flex;
  gap: 8px;
}

.radio-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--color-bg-input);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}

.radio-option:hover {
  border-color: var(--color-border-hover);
  color: var(--color-text-primary);
}

.radio-option--active {
  border-color: var(--color-accent);
  background: var(--color-accent-muted);
  color: var(--color-accent);
}

.radio-option input {
  display: none;
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--color-bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  animation: toastIn var(--transition-normal) ease-out;
  min-width: 280px;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===== MapLibre overrides ===== */
.maplibregl-popup-content {
  background: transparent !important;
  padding: 0 !important;
  box-shadow: none !important;
}

.maplibregl-popup-tip {
  display: none !important;
}

.maplibregl-ctrl-attrib {
  background: var(--color-bg-glass) !important;
  backdrop-filter: blur(8px) !important;
  color: var(--color-text-muted) !important;
  font-size: 10px !important;
}

.maplibregl-ctrl-attrib a {
  color: var(--color-text-muted) !important;
}

/* ===== Select All toggle ===== */
.select-all-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--color-border);
}

.select-all-toggle__label {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 500;
}

.select-all-toggle__btn {
  font-size: 12px;
  color: var(--color-accent);
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background var(--transition-fast);
}

.select-all-toggle__btn:hover {
  background: var(--color-accent-muted);
}

/* ===== Wizard Modal ===== */
.wizard-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn var(--transition-normal) ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.wizard {
  width: min(1100px, 94vw);
  max-height: 88vh;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: wizardIn var(--transition-slow) cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes wizardIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Wizard Header */
.wizard__header {
  padding: 24px 32px 0;
  flex-shrink: 0;
}

.wizard__title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.wizard__description {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 20px;
}

.wizard__step-heading {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--color-text-secondary);
}

/* Stepper */
.wizard__stepper {
  display: flex;
  gap: 4px;
  padding: 0 32px 20px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.wizard__step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.wizard__step:hover {
  background: var(--color-bg-card-hover);
}

.wizard__step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  border: 2px solid var(--color-border-hover);
  color: var(--color-text-muted);
  background: var(--color-bg-input);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.wizard__step--active .wizard__step-num {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: white;
}

.wizard__step--done .wizard__step-num {
  border-color: var(--color-success);
  background: var(--color-success);
  color: white;
}

.wizard__step-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
}

.wizard__step--active .wizard__step-label {
  color: var(--color-text-primary);
  font-weight: 600;
}

.wizard__step--done .wizard__step-label {
  color: var(--color-text-secondary);
}

/* Wizard Body */
.wizard__body {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  min-height: 0;
}

/* Wizard Footer */
.wizard__footer {
  padding: 16px 32px;
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--color-bg-secondary);
}

.wizard__footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wizard__footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== Geometry Cards ===== */
.geo-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.geo-card {
  background: var(--color-bg-card);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.geo-card:hover {
  border-color: var(--color-border-hover);
  background: var(--color-bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.geo-card--selected {
  border-color: var(--color-accent);
  background: var(--color-accent-muted);
  box-shadow: var(--shadow-glow);
}

.geo-card__icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: var(--color-accent-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
  font-size: 26px;
}

.geo-card--selected .geo-card__icon {
  background: var(--color-accent);
  color: white;
}

.geo-card__name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.geo-card__desc {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* Geometry resolution toggle */
.geo-toggle {
  display: flex;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.geo-toggle__btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  border: none;
  background: var(--color-bg-input);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.geo-toggle__btn:first-child {
  border-right: 1px solid var(--color-border);
}

.geo-toggle__btn:hover {
  background: var(--color-bg-card-hover);
}

.geo-toggle__btn--active {
  background: var(--color-accent-muted);
  color: var(--color-accent);
  font-weight: 600;
}

/* ===== Dataset Grid ===== */
.ds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin-top: 14px;
  max-height: 48vh;
  overflow-y: auto;
}

.ds-card {
  background: var(--color-bg-card);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ds-card:hover {
  border-color: var(--color-border-hover);
  background: var(--color-bg-card-hover);
}

.ds-card--selected {
  border-color: var(--color-accent);
  background: var(--color-accent-muted);
}

.ds-card__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.ds-card__name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}

.ds-card__code {
  font-size: 11px;
  font-family: "SF Mono", "Fira Code", monospace;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.ds-card__meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ===== Config Layout (Step 3) ===== */
.config-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.config-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.config-section__title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.config-section__title-icon {
  color: var(--color-accent);
}

.config-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 44vh;
  overflow-y: auto;
}

/* Year grid (compact) */
.year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
  max-height: 44vh;
  overflow-y: auto;
}

.year-chip {
  padding: 8px 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--color-bg-card);
  color: var(--color-text-secondary);
  user-select: none;
}

.year-chip:hover {
  border-color: var(--color-border-hover);
  background: var(--color-bg-card-hover);
}

.year-chip--selected {
  border-color: var(--color-accent);
  background: var(--color-accent-muted);
  color: var(--color-accent);
  font-weight: 600;
}

/* ===== Summary (Step 4) ===== */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.summary-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-card__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.summary-card__value {
  font-size: 16px;
  font-weight: 600;
}

.summary-card__detail {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* ===== Floating Toolbar (on map) ===== */
.map-toolbar {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}

.map-toolbar__card {
  background: var(--color-bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-toolbar__selection {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.map-toolbar__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.map-toolbar__value {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.map-toolbar__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.map-toolbar__actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

/* ===== Category filter bar ===== */
.category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}

.category-chip {
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--color-border);
  background: var(--color-bg-card);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.category-chip:hover {
  border-color: var(--color-border-hover);
  background: var(--color-bg-card-hover);
}

.category-chip--active {
  border-color: var(--color-accent);
  background: var(--color-accent-muted);
  color: var(--color-accent);
}

/* ===== Search bar (wizard) ===== */
.wizard-search {
  position: relative;
  margin-bottom: 4px;
}

.wizard-search__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

.wizard-search__input {
  width: 100%;
  padding: 12px 40px 12px 42px;
  background: var(--color-bg-input);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: 15px;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.wizard-search__input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-muted);
}

.wizard-search__input::placeholder {
  color: var(--color-text-muted);
}

.wizard-search__clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.wizard-search__clear:hover {
  background: var(--color-accent-muted);
  color: var(--color-accent);
}

/* ===== Dataset count indicator ===== */
.ds-count {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.ds-count strong {
  color: var(--color-text-secondary);
}

/* ===== Info Button (header) ===== */
.info-btn {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.info-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-muted);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.2);
}

/* ===== Info Modal ===== */
.info-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn var(--transition-fast) ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.info-modal {
  position: relative;
  width: 440px;
  max-width: calc(100vw - 32px);
  background: var(--color-bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card), 0 0 60px rgba(6, 182, 212, 0.08);
  animation: modalIn var(--transition-normal) ease-out;
  overflow: hidden;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.info-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  z-index: 1;
}

.info-modal__close:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text-primary);
  background: var(--color-bg-card-hover);
}

.info-modal__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--color-border);
}

.info-modal__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-warning), #f59e0b);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  flex-shrink: 0;
}

.info-modal__header h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.info-modal__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(251, 191, 36, 0.15);
  color: var(--color-warning);
  text-transform: uppercase;
}

.info-modal__body {
  padding: 20px 24px 24px;
}

.info-modal__body p {
  font-size: 14px;
  line-height: 1.65;
  color: var(--color-text-secondary);
  margin: 0 0 16px;
}

.info-modal__body strong {
  color: var(--color-text-primary);
}

.info-modal__section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.info-modal__section h3 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin: 0 0 8px;
}

.info-modal__section p {
  margin-bottom: 12px;
}

.info-modal__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.info-modal__link:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-muted);
}

.info-modal__footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.info-modal__org {
  font-size: 13px;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.info-modal__org:hover {
  color: var(--color-accent);
}

/* ===== Table Panel Toggle (floating button over map) ===== */
.table-toggle-btn {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--color-bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--color-border);
  border-radius: 100px;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-card);
}

.table-toggle-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-bg-card);
}

.table-toggle-btn--active {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: rgba(6, 182, 212, 0.1);
}

/* ===== Split View (map + table) ===== */
.app-main--split {
  flex-direction: column;
}

.app-main__map-area {
  flex: 1;
  position: relative;
  min-height: 200px;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.app-main__table-area {
  height: 320px;
  min-height: 160px;
  max-height: 50vh;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp var(--transition-normal) ease-out;
}

@keyframes slideUp {
  from {
    height: 0;
    opacity: 0;
  }
  to {
    height: 320px;
    opacity: 1;
  }
}

.table-resize-handle {
  height: 4px;
  background: transparent;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.table-resize-handle:hover,
.table-resize-handle:active {
  background: var(--color-accent-muted);
}

.table-resize-handle::after {
  content: "";
  width: 32px;
  height: 3px;
  border-radius: 2px;
  background: var(--color-border-hover);
  transition: background var(--transition-fast);
}

.table-resize-handle:hover::after {
  background: var(--color-accent);
}

/* ===== DataTable Component ===== */
.dt {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.dt-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  flex-shrink: 0;
}

.dt-search {
  position: relative;
  flex: 1;
  max-width: 280px;
}

.dt-search__icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

.dt-search__input {
  width: 100%;
  padding: 6px 30px 6px 30px;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-size: 13px;
  font-family: inherit;
  transition: border-color var(--transition-fast);
}

.dt-search__input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.dt-search__input::placeholder {
  color: var(--color-text-muted);
}

.dt-search__clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--color-bg-card);
  border-radius: 50%;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dt-search__clear:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-card-hover);
}

.dt-toolbar__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.dt-toolbar__count {
  font-size: 12px;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.dt-toolbar__export {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dt-toolbar__export:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Scrollable table area */
.dt-scroll {
  flex: 1;
  overflow: auto;
}

.dt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}

/* Header */
.dt-th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--color-bg-card);
  padding: 8px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--color-border);
  transition: color var(--transition-fast);
}

.dt-th:hover {
  color: var(--color-text-primary);
}

.dt-th span {
  display: inline;
  vertical-align: middle;
}

.dt-th--sticky {
  position: sticky;
  left: 0;
  z-index: 3;
}

.dt-th--name {
  min-width: 160px;
  max-width: 220px;
}

.dt-th--data {
  min-width: 100px;
  text-align: right;
}

.dt-sort-icon {
  display: inline;
  vertical-align: middle;
  margin-left: 4px;
}

.dt-sort-icon--neutral {
  opacity: 0.3;
}

.dt-sort-icon--active {
  color: var(--color-accent);
  opacity: 1;
}

/* Body rows */
.dt-tr {
  transition: background var(--transition-fast);
  cursor: pointer;
}

.dt-tr:hover {
  background: var(--color-bg-card-hover);
}

.dt-tr--highlighted {
  background: var(--color-accent-muted) !important;
}

.dt-td {
  padding: 7px 12px;
  border-bottom: 1px solid rgba(30, 41, 59, 0.5);
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.dt-td--sticky {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--color-bg-secondary);
}

.dt-tr:hover .dt-td--sticky {
  background: var(--color-bg-card-hover);
}

.dt-tr--highlighted .dt-td--sticky {
  background: var(--color-accent-muted) !important;
}

.dt-td--name {
  font-weight: 500;
  color: var(--color-text-primary);
  min-width: 160px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dt-td--data {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 12px;
}

/* ============================================================
   DATA EXPLORER
   ============================================================ */

/* ===== Explorer Layout ===== */
.explorer-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.explorer-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-bg-primary);
}

/* Nav button in header */
.explorer-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-bg-glass);
  color: var(--color-text-primary);
  text-decoration: none;
  transition: all 0.15s ease;
  cursor: pointer;
}
.explorer-nav-btn:hover {
  background: var(--color-accent-muted);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* ===== Dataset Browser (Sidebar) ===== */
.ds-browser {
  width: 340px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-secondary);
  border-right: 1px solid var(--color-border);
  overflow: hidden;
}

.ds-browser__header {
  padding: 16px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.ds-browser__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--color-text-primary);
}
.ds-browser__count {
  font-size: 12px;
  color: var(--color-text-muted);
  background: var(--color-bg-input);
  padding: 3px 10px;
  border-radius: 100px;
}

/* Collection filter */
.ds-browser__collections {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 16px 6px;
  flex-shrink: 0;
}
.ds-browser__collection-btn {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--color-border);
  border-radius: 100px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.12s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ds-browser__collection-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-text-primary);
}
.ds-browser__collection-btn--active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}

/* Level pills */
.ds-browser__levels {
  display: flex;
  gap: 4px;
  padding: 10px 16px;
  flex-shrink: 0;
}
.ds-browser__level-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 0;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.ds-browser__level-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-text-primary);
}
.ds-browser__level-btn--active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}
.ds-browser__level-btn--active:hover {
  color: white;
}

/* Search */
.ds-browser__search {
  position: relative;
  padding: 0 16px 10px;
  flex-shrink: 0;
}
.ds-browser__search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-75%);
  color: var(--color-text-muted);
  pointer-events: none;
}
.ds-browser__search-input {
  width: 100%;
  padding: 8px 32px 8px 36px;
  font-size: 13px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-input);
  color: var(--color-text-primary);
  outline: none;
  transition: border-color 0.15s;
}
.ds-browser__search-input:focus {
  border-color: var(--color-accent);
}
.ds-browser__search-clear {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-75%);
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 2px;
}

/* Category list */
.ds-browser__list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.ds-browser__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--color-text-muted);
  font-size: 13px;
}

.ds-browser__category {
  border-bottom: 1px solid var(--color-border);
}
.ds-browser__category:last-child {
  border-bottom: none;
}
.ds-browser__category-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}
.ds-browser__category-header:hover {
  background: var(--color-bg-card);
}
.ds-browser__category-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ds-browser__category-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-bg-input);
  padding: 2px 8px;
  border-radius: 100px;
}

/* Dataset items */
.ds-browser__category-items {
  padding: 0 8px 6px;
}
.ds-browser__item {
  width: 100%;
  display: block;
  padding: 9px 12px;
  margin-bottom: 2px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.12s ease;
}
.ds-browser__item:hover {
  background: var(--color-bg-card);
  border-color: var(--color-border);
}
.ds-browser__item--active {
  background: var(--color-accent-muted) !important;
  border-color: var(--color-accent) !important;
}
.ds-browser__item-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--color-text-primary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ds-browser__item--active .ds-browser__item-name {
  color: var(--color-accent);
}
.ds-browser__item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.ds-browser__item-id {
  font-size: 10px;
  font-family: monospace;
  color: var(--color-text-muted);
  opacity: 0.7;
}
.ds-browser__item-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-bg-input);
  padding: 1px 6px;
  border-radius: 100px;
}
.ds-browser__item-badge--source {
  font-weight: 600;
  font-size: 9px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ===== Data Preview ===== */
.ds-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ds-preview__loading {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 14px;
  color: var(--color-text-muted);
}
.ds-preview__error {
  padding: 24px;
  margin: 16px;
  border-radius: var(--radius-md);
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.2);
  color: #fca5a5;
  font-size: 14px;
}

/* Header */
.ds-preview__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.ds-preview__header-left {
  flex: 1;
  min-width: 0;
}
.ds-preview__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0;
  line-height: 1.3;
}
.ds-preview__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--color-text-muted);
  flex-wrap: wrap;
}
.ds-preview__id {
  font-family: monospace;
  background: var(--color-bg-input);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}
.ds-preview__sep {
  opacity: 0.3;
}
.ds-preview__header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Level toggle in preview header */
.ds-preview__level-toggle {
  display: flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.ds-preview__level-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  background: var(--color-bg-input);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.12s ease;
}
.ds-preview__level-btn:not(:last-child) {
  border-right: 1px solid var(--color-border);
}
.ds-preview__level-btn:hover {
  color: var(--color-text-primary);
}
.ds-preview__level-btn--active {
  background: var(--color-accent);
  color: white;
}

/* Info button */
.ds-preview__info-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-input);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.ds-preview__info-btn:hover,
.ds-preview__info-btn--active {
  background: var(--color-accent-muted);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Info panel */
.ds-preview__info-panel {
  padding: 14px 20px;
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.55;
  animation: slideDown 0.15s ease-out;
}
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.ds-preview__info-panel p {
  margin: 0 0 10px;
}
.ds-preview__info-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.ds-preview__info-grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ds-preview__info-grid strong {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}
.ds-preview__info-grid span {
  font-size: 12px;
  color: var(--color-text-primary);
}

/* Toolbar */
.ds-preview__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.ds-preview__toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ds-preview__page-size {
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-input);
  color: var(--color-text-primary);
  cursor: pointer;
}

/* Table wrapper */
.ds-preview__table-wrap {
  flex: 1;
  overflow: auto;
  position: relative;
}
.ds-preview__table-loading {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  backdrop-filter: blur(2px);
}

/* ===== Pagination ===== */
.ds-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  flex-shrink: 0;
}
.ds-pagination__info {
  font-size: 12px;
  color: var(--color-text-muted);
}
.ds-pagination__controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ds-pagination__btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-input);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.12s ease;
  font-size: 12px;
  font-weight: 500;
}
.ds-pagination__btn:hover:not(:disabled) {
  border-color: var(--color-accent);
  color: var(--color-accent);
}
.ds-pagination__btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.ds-pagination__btn--page {
  min-width: 32px;
  width: auto;
  padding: 0 6px;
}
.ds-pagination__btn--active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}
.ds-pagination__btn--active:hover {
  color: white;
}

/* ===== Explorer Empty State ===== */
.explorer-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}
.explorer-empty__icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-accent-muted);
  color: var(--color-accent);
  margin-bottom: 20px;
}
.explorer-empty h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0 0 8px;
}
.explorer-empty p {
  font-size: 14px;
  color: var(--color-text-muted);
  margin: 0 0 32px;
}
.explorer-empty__stats {
  display: flex;
  gap: 32px;
}
.explorer-empty__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.explorer-empty__stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-accent);
}
.explorer-empty__stat-label {
  font-size: 12px;
  color: var(--color-text-muted);
}
