:root {
  --bg: #F1F5F9;
  --card: #FFFFFF;
  --border: #E2E8F0;
  --header-bg: #111827;
  --header-subtle: #9CA3AF;
  --accent: #16A34A;
  --accent-dark: #127A3D;
  --accent-tint: #ECFDF5;
  --text: #111827;
  --muted: #6B7280;
  --error: #DC2626;
  --warning: #B45309;
  --warning-tint: #FFFBEB;
  --success: #15803D;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 1px rgba(15, 23, 42, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 13px;
}

.header {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--header-bg);
  padding: 9px 18px;
  border-bottom: 2px solid var(--accent);
}

.badge {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--accent);
  color: white;
  font-weight: bold;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
}

.title-box { display: flex; align-items: baseline; gap: 8px; }
.title-box .title { color: white; font-weight: bold; font-size: 20px; }
.title-box .tagline { color: var(--header-subtle); font-size: 14px; }
.version { margin-left: auto; color: var(--header-subtle); font-size: 11px; }

.body {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 12px;
  margin-bottom: 10px;
  align-items: stretch;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 10px 12px;
  margin-bottom: 10px;
}

.card h2, .section-title {
  margin: 0 0 8px 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
}

.field { margin-bottom: 6px; }
.field label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.field input[type="file"] { font-size: 12px; width: 100%; }

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 11px;
  color: var(--text);
  margin-top: 6px;
  cursor: pointer;
}
.checkbox-field input { margin-top: 2px; }

.file-list {
  list-style: none;
  margin: 0 0 6px 0;
  padding: 0;
  max-height: 110px;
  overflow-y: auto;
}
.file-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  margin-bottom: 4px;
  background: #F8FAFC;
}
.file-list .file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-list .file-remove {
  border: none;
  background: none;
  color: var(--error);
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 3px;
}
.file-list .file-remove:hover { color: #991B1B; }

.hint {
  font-size: 11px;
  color: var(--muted);
  background: #F8FAFC;
  border: 1px dashed var(--border);
  border-radius: 5px;
  padding: 5px 8px;
  margin-top: 4px;
}
.lib-hint { border-style: solid; background: var(--accent-tint); border-color: #A7F3D0; color: var(--accent-dark); }

textarea {
  width: 100%;
  font-family: inherit;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 7px 8px;
  resize: vertical;
}

.preview-line {
  font-size: 11px;
  margin-top: 5px;
  line-height: 1.4;
}
.preview-label { font-weight: 700; color: var(--text); margin-right: 4px; }
.preview-value { color: var(--muted); }

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.accent-btn, .ghost-btn {
  border: none;
  border-radius: 5px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.05s ease;
}
.accent-btn { background: var(--accent); color: white; }
.accent-btn:hover { background: var(--accent-dark); }
.accent-btn:active { transform: scale(0.98); }
.accent-btn:disabled { background: #9CA3AF; cursor: default; }

.ghost-btn { background: white; color: var(--accent-dark); border: 1px solid var(--border); }
.ghost-btn:hover { background: var(--accent-tint); border-color: #A7F3D0; }

.status { font-size: 12px; font-weight: 700; color: var(--muted); }
.status.success { color: var(--success); }
.status.error { color: var(--error); }

.spinner {
  width: 15px; height: 15px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.stat-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 8px 10px;
}
.stat-tile.warn { border-left-color: var(--warning); background: var(--warning-tint); }
.stat-value { font-size: 19px; font-weight: 800; color: var(--text); line-height: 1.1; }
.stat-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.3px; margin-top: 2px; }

.log-card { padding-bottom: 6px; }

.log {
  background: #0B1220;
  color: #E5E7EB;
  font-family: Consolas, monospace;
  font-size: 11px;
  padding: 8px 10px;
  border-radius: 5px;
  min-height: 90px;
  max-height: 160px;
  overflow-y: auto;
  white-space: pre-wrap;
  margin: 0;
}
.log .warning { color: #FBBF24; }
.log .error { color: #F87171; }
.log .success { color: #4ADE80; }

.preview-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.preview-box {
  flex: 1 1 320px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 8px;
}

.preview-label { font-size: 11px; font-weight: 700; margin-bottom: 5px; color: var(--muted); }

.svg-holder {
  width: 100%;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: white;
}
.svg-holder svg { width: 100%; height: auto; display: block; }

.step-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.step-toolbar .ghost-btn { padding: 6px 10px; font-size: 14px; }
.step-slider { flex: 1; }
.step-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  min-width: 190px;
  text-align: right;
}
.step-svg-holder { max-height: 420px; }

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--error);
  margin-left: 6px;
  animation: pulse 1s ease-in-out infinite;
}
.live-dot.idle { animation: none; background: var(--border); }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

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