:root {
  --primary: #0d6efd;
  --primary-hover: #0b5ed7;
  --primary-active: #0a58ca;
  --danger: #dc3545;
  --danger-hover: #bb2d3b;
  --bg: #f6f8fa;
  --card: #ffffff;
  --border: #dee2e6;
  --text: #212529;
  --muted: #6c757d;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

/* ---------- Navbar ---------- */
.navbar {
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  box-shadow: var(--shadow);
}
.navbar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 600;
}
.navbar .brand img {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: block;
}
.navbar .spacer { flex: 1; }
.navbar select {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 0.9rem;
}
.navbar select option { color: #212529; }

/* ---------- Layout ---------- */
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}
.intro { color: var(--muted); margin: 4px 0 24px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.card h2 {
  margin: 0 0 16px;
  font-size: 1.1rem;
}

/* ---------- Form ---------- */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
}
.field .hint { color: var(--muted); font-weight: 400; font-size: 0.82rem; }
select,
input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  background: #fff;
  color: var(--text);
}
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 160px; }

.fw-info { color: var(--muted); font-size: 0.85rem; margin-top: 6px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:not(:disabled):hover { background: var(--primary-hover); }
.btn-outline {
  background: #fff;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:not(:disabled):hover { background: var(--primary); color: #fff; }
.btn-danger-outline {
  background: #fff;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger-outline:not(:disabled):hover { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-block { width: 100%; }

/* ---------- Action list ---------- */
.actions { display: flex; flex-direction: column; gap: 12px; }
.action {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.action .action-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(13, 110, 253, 0.1);
  color: var(--primary);
}
.action.danger .action-icon { background: rgba(220, 53, 69, 0.1); color: var(--danger); }
.action .action-body { flex: 1; min-width: 0; }
.action .action-title { font-weight: 600; }
.action .action-hint { color: var(--muted); font-size: 0.85rem; }
.action .btn { flex: 0 0 auto; }

/* ---------- Progress / log ---------- */
.progress-outer {
  background: #e9ecef;
  border-radius: 6px;
  height: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-bar {
  background: var(--primary);
  height: 100%;
  width: 0%;
  transition: width 0.15s;
}
.status { font-size: 0.9rem; margin-bottom: 10px; }
.status.error { color: var(--danger); }
.status.success { color: #198754; }
.log,
.console-output {
  background: #1e1e1e;
  color: #d4d4d4;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.8rem;
  padding: 12px;
  border-radius: 6px;
  height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- Alerts ---------- */
.alert {
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 20px;
}
.alert-warn { background: #fff3cd; border: 1px solid #ffe69c; color: #664d03; }
.alert h2 { margin: 0 0 8px; font-size: 1.05rem; }

.hidden { display: none !important; }

.subtle-toggle {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 0;
}

.offset-input { max-width: 120px; }
.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.file-row label { flex: 0 0 160px; font-weight: 600; font-size: 0.85rem; }

@media (max-width: 560px) {
  .action { flex-wrap: wrap; }
  .action .btn { width: 100%; }
}
