:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --primary: #2563eb;
  --primary2: #1d4ed8;
  --text: #1e293b;
  --muted: #64748b;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --border: #e2e8f0;
  --result-bg: #f8fafc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}

.header h1 {
  margin: 0 0 6px;
  font-size: 1.65rem;
  font-weight: 700;
}

.subtitle {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px 18px;
}

.card h2 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  color: var(--primary);
  font-weight: 700;
}

.field-label {
  display: block;
  margin: 10px 0 4px;
  font-size: 0.95rem;
}

.file-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.file-name,
select,
input[type="number"],
input[type="text"] {
  flex: 1;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 0.95rem;
  background: #fff;
  color: var(--text);
}

.file-name {
  color: var(--muted);
}

.param-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
}

.param-grid .field-label {
  margin: 0;
}

.param-grid select,
.param-grid input {
  width: 180px;
  justify-self: end;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.note {
  margin: 10px 0 0;
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-radius: 3px;
  background: var(--primary);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary2);
}

.btn-primary:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.btn-sec {
  display: inline-block;
  padding: 8px 12px;
  border: none;
  border-radius: 3px;
  background: #e2e8f0;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  text-align: center;
}

.btn-sec:hover:not(.disabled) {
  background: #cbd5e1;
}

.btn-sec.disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

.progress-wrap {
  margin: 12px 0 6px;
  height: 14px;
  background: #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: #0ea5e9;
  width: 0%;
  transition: width 0.2s ease;
}

#status {
  margin: 0;
}

.card-result {
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

.result-box {
  flex: 1;
  margin: 0;
  padding: 12px 14px;
  background: var(--result-bg);
  border: none;
  border-radius: 3px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 220px;
  color: var(--text);
}

.result-box.ok {
  color: var(--ok);
}

.result-box.warn {
  color: var(--warn);
}

.result-box.err {
  color: var(--err);
}

.result-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

@media (max-width: 860px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .param-grid {
    grid-template-columns: 1fr;
  }

  .param-grid select,
  .param-grid input {
    width: 100%;
    justify-self: stretch;
  }
}
