* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: #eceff3;
  color: #1f2937;
}

.page {
  max-width: 1040px;
  margin: 18px auto 32px;
  padding: 0 16px;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.page-header h1 {
  margin: 0;
  font-size: 36px;
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
}

.status-pill.done {
  background: #d1fae5;
  color: #047857;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.card {
  background: #ffffff;
  border: 1px solid #d9dee7;
  border-radius: 12px;
  padding: 18px;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 28px;
}

.form-grid {
  display: grid;
  gap: 10px;
}

label {
  font-size: 12px;
  letter-spacing: 0.04em;
  color: #6b7280;
  font-weight: 700;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  border: 1px solid #d4dae4;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px;
  font-size: 14px;
  color: #111827;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  color: #6b7280;
  font-size: 13px;
}

.tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.info-icon {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1px solid #94a3b8;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  background: #f8fafc;
  cursor: help;
}

.tooltip-text {
  position: absolute;
  left: 24px;
  top: -8px;
  width: 320px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.35;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 20;
}

.tooltip-wrap:hover .tooltip-text,
.tooltip-wrap:focus .tooltip-text,
.tooltip-wrap:focus-within .tooltip-text {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.btn {
  border: 0;
  border-radius: 8px;
  font-size: 14px;
  padding: 9px 14px;
  font-weight: 700;
  cursor: pointer;
}

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

.btn-primary { background: #4f8df6; color: #fff; }
.btn-muted { background: #d7dce6; color: #243244; }
.btn-danger { background: #f3a8af; color: #7f1d1d; }
.btn-success { background: #10b981; color: #fff; }
.btn-ghost { background: #e6ebf3; color: #334155; padding: 5px 10px; font-size: 12px; }

.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.metric-tile {
  background: #f3f5f9;
  border-radius: 10px;
  border: 1px solid #e1e6ef;
  padding: 12px;
}

.metric-label {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: #6b7280;
  font-weight: 700;
}

.metric-value {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: #111827;
}

.metric-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  word-break: break-all;
}

.output-files h3 {
  margin: 14px 0 10px;
  font-size: 25px;
}

.exports-empty {
  color: #6b7280;
  font-size: 14px;
}

.export-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.export-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  border-top: 1px solid #e5eaf2;
  padding-top: 10px;
}

.export-name {
  margin: 0;
  font-size: 14px;
  color: #1d4ed8;
  text-decoration: none;
}

.export-meta {
  margin: 3px 0 0;
  color: #6b7280;
  font-size: 12px;
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.file-btn {
  border: 0;
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
}

.file-btn.csv { background: #3b82f6; color: #fff; opacity: 0.5; cursor: not-allowed; }
.file-btn.xlsx { background: #10b981; color: #fff; text-decoration: none; display: inline-flex; align-items: center; }

.log-card h2 {
  margin: 0;
  font-size: 30px;
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

#logs {
  background: #081532;
  color: #dbeafe;
  min-height: 220px;
  max-height: 320px;
  margin: 0;
  border-radius: 8px;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.45;
}

.status-line {
  margin: 12px 0 6px;
  font-weight: 700;
}

.result-line {
  margin: 0;
  color: #334155;
}

.footer-row {
  justify-content: flex-end;
}

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