:root {
  --bg: #f2f4f5;
  --ink: #18212b;
  --muted: #5a6673;
  --panel: #ffffff;
  --line: #d4dce3;
  --accent: #045d5d;
  --accent-strong: #003f3f;
  --warning: #915d00;
  --shadow: 0 14px 34px rgba(24, 33, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, #ddeee3 0%, rgba(221, 238, 227, 0) 34%),
    radial-gradient(circle at 90% 92%, #dbeaf1 0%, rgba(219, 234, 241, 0) 38%),
    var(--bg);
  color: var(--ink);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.app-shell {
  width: min(1220px, 94vw);
  margin: 3rem auto 4rem;
}

.hero h1 {
  margin: 0.25rem 0 0.5rem;
  font-size: clamp(2rem, 3.5vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  font-weight: 700;
}

.hero-copy {
  margin: 0;
  color: var(--muted);
  max-width: 70ch;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-top: 1rem;
}

.upload-panel {
  border-top: 6px solid var(--accent);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field span {
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 600;
}

input[type="file"] {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 0.55rem;
  font-family: inherit;
  background: #fbfdfd;
}

.drop-zone {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  background: #fbfdfd;
  display: grid;
  gap: 0.2rem;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.drop-zone strong {
  font-size: 0.86rem;
  color: var(--ink);
}

.drop-zone span {
  font-size: 0.8rem;
  color: var(--muted);
}

.drop-zone:hover {
  border-color: #9fc7cc;
}

.drop-zone.dragging {
  border-color: var(--accent);
  background: #eef8f8;
  box-shadow: inset 0 0 0 1px rgba(4, 93, 93, 0.25);
}

.drop-zone.has-file {
  border-style: solid;
  border-color: #7db8b8;
  background: #f1fbfb;
}

.actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.6rem 1rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}

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

.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  border-color: var(--accent-strong);
  color: #f2fffb;
}

.btn-subtle {
  background: #ffffff;
  color: var(--ink);
}

.show-raw {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.84rem;
  color: var(--muted);
}

.status {
  margin: 0.85rem 0 0;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  background: #f7fbfd;
  border: 1px solid #e2edf3;
  color: #184f73;
  font-size: 0.89rem;
}

.status.warn {
  color: #784f0a;
  border-color: #f2dfc4;
  background: #fff8eb;
}

.status.error {
  color: #8f2222;
  border-color: #f4d3d3;
  background: #fff1f1;
}

.result-panel {
  display: grid;
  gap: 1rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.panel-head h2 {
  margin: 0;
}

.export-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 0.9rem;
}

.summary-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem;
  background: #fbfcfd;
}

.summary-card h3 {
  margin-top: 0;
  margin-bottom: 0.7rem;
}

.kv-list {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(100px, 160px) 1fr;
  row-gap: 0.4rem;
}

.kv-list dt {
  color: var(--muted);
  font-size: 0.86rem;
}

.kv-list dd {
  margin: 0;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.86rem;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.table-wrap h3 {
  margin: 0;
  padding: 0.8rem 0.9rem;
  background: #f7fafb;
  border-bottom: 1px solid var(--line);
}

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

th,
td {
  text-align: left;
  border-bottom: 1px solid #edf1f4;
  padding: 0.6rem 0.75rem;
  vertical-align: top;
  font-size: 0.86rem;
}

th {
  font-size: 0.77rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: #fcfdfe;
}

td {
  font-family: "IBM Plex Mono", Consolas, monospace;
}

tbody tr:hover {
  background: #f7fbfe;
}

.line-list {
  margin: 0;
  padding: 0 0 0 1.15rem;
  display: grid;
  gap: 0.35rem;
}

.line-list li {
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.84rem;
}

.raw-card pre {
  margin: 0;
  border: 1px solid #e5ecf1;
  background: #fbfdff;
  border-radius: 8px;
  padding: 0.85rem;
  max-height: 340px;
  overflow: auto;
  font-size: 0.82rem;
  white-space: pre-wrap;
  font-family: "IBM Plex Mono", Consolas, monospace;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .app-shell {
    margin-top: 2rem;
  }

  .panel {
    border-radius: 12px;
    padding: 0.9rem;
  }

  th,
  td {
    padding: 0.5rem;
  }

  .kv-list {
    grid-template-columns: 1fr;
  }
}
