:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --border: #d9e0ea;
  --primary: #2663eb;
  --primary-dark: #1747b3;
  --success: #0f8f5f;
  --shadow: 0 18px 45px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, #e7efff 0, transparent 34rem), var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 0.75rem;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 0.8rem 1rem;
  transition: background 0.2s ease, transform 0.2s ease;
}

button:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button.secondary {
  background: #eef3ff;
  color: var(--primary);
}

button.secondary:hover:not(:disabled) {
  background: #dfe9ff;
}

.app-shell {
  margin: 0 auto;
  max-width: 1440px;
  padding: 2rem;
}

.hero {
  align-items: stretch;
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr minmax(16rem, 22rem);
  margin-bottom: 1.5rem;
}

.eyebrow {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  margin: 0 0 0.6rem;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
  margin: 0;
}

.hero-text {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 1rem 0 0;
}

.hero-card,
.panel,
.stat-card {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(217, 224, 234, 0.88);
  border-radius: 1.25rem;
  box-shadow: var(--shadow);
}

.hero-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.4rem;
}

.hero-card__label,
.stat-card span,
.field label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.hero-card strong {
  color: var(--success);
  font-size: 1.2rem;
  margin-top: 0.5rem;
}

.panel {
  margin-bottom: 1rem;
  padding: 1rem;
}

.upload-panel,
.controls-panel,
.table-toolbar {
  align-items: center;
  display: flex;
  gap: 1rem;
}

.drop-zone {
  align-items: center;
  border: 2px dashed var(--border);
  border-radius: 1rem;
  cursor: pointer;
  display: grid;
  flex: 1;
  gap: 0.15rem;
  grid-template-columns: auto 1fr;
  padding: 1rem;
}

.drop-zone.is-dragover {
  background: #f2f6ff;
  border-color: var(--primary);
}

.drop-zone input {
  display: none;
}

.drop-zone__icon {
  align-items: center;
  background: #eef3ff;
  border-radius: 50%;
  color: var(--primary);
  display: inline-flex;
  font-size: 1.4rem;
  grid-row: span 2;
  height: 3rem;
  justify-content: center;
  margin-right: 0.7rem;
  width: 3rem;
}

.drop-zone__title {
  font-weight: 800;
}

.drop-zone__hint,
.table-toolbar,
.empty-cell {
  color: var(--muted);
}

.sample-actions {
  display: flex;
  gap: 0.75rem;
}

.stats-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.stat-card {
  padding: 1rem;
}

.stat-card strong {
  display: block;
  font-size: 2rem;
  line-height: 1.1;
  margin-top: 0.35rem;
}

.controls-panel {
  flex-wrap: wrap;
}

.feature-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  margin-bottom: 1rem;
}

.feature-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.panel-heading h2 {
  font-size: 1.15rem;
  margin: 0 0 0.35rem;
}

.panel-heading p {
  color: var(--muted);
  margin: 0;
}

.lookup-controls {
  align-items: end;
  display: flex;
  gap: 0.75rem;
}

.field--compact {
  flex: 0 0 12rem;
}

.field {
  display: grid;
  flex: 1;
  gap: 0.4rem;
  min-width: 12rem;
}

.field input,
.field select,
.stack-input {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  color: var(--text);
  min-height: 2.8rem;
  padding: 0 0.8rem;
}

.lookup-results {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  max-height: 18rem;
  overflow: auto;
  padding: 0.8rem;
}

.lookup-result {
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem 0;
}

.lookup-result:first-child {
  padding-top: 0;
}

.lookup-result:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.lookup-result code,
.stack-output {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.lookup-result__main {
  color: var(--text);
  font-size: 0.9rem;
  word-break: break-word;
}

.lookup-result__meta,
.empty-state {
  color: var(--muted);
  font-size: 0.86rem;
}

.stack-input {
  line-height: 1.5;
  min-height: 12rem;
  padding: 0.8rem;
  resize: vertical;
  width: 100%;
}

.stack-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.stack-output {
  background: #101828;
  border-radius: 0.85rem;
  color: #e6edf7;
  line-height: 1.5;
  margin: 0;
  max-height: 18rem;
  overflow: auto;
  padding: 1rem;
  white-space: pre-wrap;
}

.table-panel {
  padding: 0;
  overflow: hidden;
}

.table-toolbar {
  justify-content: space-between;
  padding: 1rem;
}

.table-toolbar p {
  margin: 0;
}

.pagination {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  white-space: nowrap;
}

.table-wrap {
  overflow: auto;
  max-height: 68vh;
}

table {
  border-collapse: collapse;
  min-width: 1300px;
  width: 100%;
}

th,
td {
  border-top: 1px solid var(--border);
  max-width: 26rem;
  padding: 0.78rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f7f9fd;
  font-size: 0.82rem;
  position: sticky;
  top: 0;
  z-index: 1;
}

td {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  word-break: break-word;
}

.badge {
  border-radius: 99rem;
  display: inline-flex;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.18rem 0.55rem;
}

.badge--class {
  background: #eaf2ff;
  color: #175cd3;
}

.badge--field {
  background: #ecfdf3;
  color: #067647;
}

.badge--method {
  background: #fff4e5;
  color: #b54708;
}

.empty-cell {
  font-family: inherit;
  padding: 3rem;
  text-align: center;
}

@media (max-width: 900px) {
  .app-shell {
    padding: 1rem;
  }

  .hero,
  .stats-grid,
  .feature-grid {
    grid-template-columns: 1fr;
  }

  .upload-panel,
  .lookup-controls,
  .sample-actions,
  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .field--compact {
    flex-basis: auto;
  }

  .pagination {
    justify-content: space-between;
    width: 100%;
  }
}
