.top-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.indent-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.ctrl-label { font-size: 0.8rem; color: var(--text-sub); }
.indent-btn {
  padding: 0.3rem 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-sub);
  font-size: 0.78rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
}
.indent-btn.active, .indent-btn:hover {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.status-badge {
  font-size: 0.78rem;
  padding: 0.3rem 0.8rem;
  border-radius: 99px;
  font-weight: 600;
}
.status-idle    { background: #f1f5f9; color: var(--text-sub); }
.status-valid   { background: #dcfce7; color: #166534; }
.status-invalid { background: #fee2e2; color: #991b1b; }

textarea {
  width: 100%;
  height: 200px;
  padding: 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  font-family: "Cascadia Code", "Consolas", "Monaco", monospace;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.6;
}
textarea:focus { border-color: var(--blue); }
textarea.error  { border-color: var(--red); }
textarea.valid  { border-color: var(--green); }
textarea[readonly] { background: var(--bg); cursor: default; }

.error-msg {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  font-size: 0.82rem;
  color: #991b1b;
  margin-bottom: 0.75rem;
  font-family: monospace;
}

.btn-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.75rem 0;
}

.stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-sub);
}
.stats span {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
}

html[data-theme="dark"] textarea,
html[data-theme="dark"] .indent-btn { background: #0f172a; }
html[data-theme="dark"] .status-valid   { background: #052e16; color: #4ade80; }
html[data-theme="dark"] .status-invalid { background: #450a0a; color: #fca5a5; }
html[data-theme="dark"] .error-msg { background: #450a0a; border-color: #7f1d1d; color: #fca5a5; }

@media (max-width: 480px) {
  .top-controls { flex-direction: column; align-items: flex-start; }
  .btn-row { gap: 0.4rem; }
  .btn { font-size: 0.82rem; padding: 0.5rem 0.9rem; }
}
