:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4d;
  --text: #e6edf3;
  --muted: #8b9cb3;
  --accent: #3d9eff;
  --error: #f85149;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.wrap {
  max-width: 52rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}

.lead {
  color: var(--muted);
  margin: 0 0 1.75rem;
  font-size: 0.95rem;
}

.hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.file-label {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.file-label input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.file-prompt {
  display: inline-block;
  padding: 0.55rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
}

.file-label:hover .file-prompt {
  border-color: var(--accent);
}

button[type="submit"],
.btn-secondary {
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

button[type="submit"] {
  background: var(--accent);
  color: #0a0e14;
  border: none;
}

.btn-secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  color: var(--text);
  border-color: var(--accent);
}

button[type="submit"]:disabled,
.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.status {
  margin-top: 1rem;
  font-size: 0.9rem;
}

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

.result {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.result-head h2 {
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
}

.meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1rem;
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.meta dt {
  font-weight: 500;
  color: var(--text);
}

.sections {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.section-card {
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.section-card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
}

.section-card .section-n {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 400;
  margin-left: 0.35rem;
}

.section-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.8rem;
  line-height: 1.45;
}

.raw-wrap {
  margin-top: 0.5rem;
}

.raw-wrap summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.raw-wrap summary:hover {
  color: var(--text);
}

.output {
  margin: 0;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  max-height: min(60vh, 520px);
  overflow: auto;
}

.output--raw {
  max-height: min(40vh, 360px);
}

.table-wrap {
  margin-bottom: 1.5rem;
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}

.btn-export {
  padding: 0.5rem 1rem;
  background: #2ea043;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-export:hover {
  background: #2c974b;
}

.table-container {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table thead {
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--accent);
  border-bottom: 2px solid var(--border);
}

.data-table th:nth-child(3) {
  width: 180px;
  min-width: 180px;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.8rem;
  line-height: 1.45;
}

.data-table td:nth-child(3) {
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: rgba(61, 158, 255, 0.05);
}

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