:root {
  --bg: #f5efe4;
  --panel: rgba(255, 252, 246, 0.82);
  --panel-border: rgba(33, 31, 29, 0.12);
  --text: #1f1b18;
  --muted: #6f645a;
  --accent: #c45c2b;
  --accent-dark: #8f3b16;
  --success: #1f7a57;
  --error: #a12727;
  --shadow: 0 24px 60px rgba(64, 44, 18, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(196, 92, 43, 0.28), transparent 28%),
    radial-gradient(circle at right, rgba(31, 122, 87, 0.18), transparent 24%),
    linear-gradient(135deg, #efe5d1 0%, #f8f4ec 55%, #e8dfd2 100%);
}

.shell {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 56px;
}

.hero {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  max-width: 720px;
  font-size: clamp(2.3rem, 5vw, 4.2rem);
  line-height: 0.95;
}

.lede {
  max-width: 680px;
  margin: 14px 0 0;
  font-size: 1.02rem;
  color: var(--muted);
}

.panel {
  padding: 22px;
  margin-bottom: 18px;
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.upload-form {
  display: grid;
  gap: 12px;
}

.file-label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(196, 92, 43, 0.12);
  color: var(--accent-dark);
  font-weight: 700;
}

input[type="file"] {
  width: 100%;
  padding: 18px;
  border: 1px dashed rgba(31, 27, 24, 0.22);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
  font: inherit;
}

.selected-file,
.status {
  margin: 0;
  color: var(--muted);
}

button {
  width: fit-content;
  padding: 12px 18px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #fff7f0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease;
}

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

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

.ghost-button {
  background: rgba(31, 27, 24, 0.08);
  color: var(--text);
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.result-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.view-toggle {
  display: inline-flex;
  padding: 4px;
  border-radius: 16px;
  background: rgba(31, 27, 24, 0.06);
}

.tab-button {
  padding: 10px 14px;
}

.tab-button.active {
  background: var(--accent);
  color: #fff7f0;
}

.result-view.hidden {
  display: none;
}

.table-section + .table-section {
  margin-top: 18px;
}

.table-wrap {
  overflow: auto;
  margin-top: 10px;
  border: 1px solid rgba(31, 27, 24, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.52);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(31, 27, 24, 0.08);
  vertical-align: top;
}

.data-table th {
  background: rgba(31, 27, 24, 0.05);
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.label-cell {
  width: 220px;
  font-weight: 700;
}

.value-cell,
.empty-cell {
  color: var(--text);
}

.empty-cell {
  color: var(--muted);
}

.result {
  margin: 0;
  min-height: 320px;
  overflow: auto;
  padding: 18px;
  border-radius: 18px;
  background: #1d1a17;
  color: #efe5d1;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.55;
}

.status.loading {
  color: var(--accent-dark);
}

.status.success {
  color: var(--success);
}

.status.error {
  color: var(--error);
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 960px);
    padding-top: 26px;
  }

  .panel {
    padding: 16px;
    border-radius: 20px;
  }

  .result-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .result-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

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

  .tab-button,
  .result-actions .ghost-button {
    width: 100%;
  }
}
