:root {
  --bg: #0f172a;
  --card: #1e293b;
  --accent: #38bdf8;
  --success: #22c55e;
  --border: #334155;
  --text: #f1f5f9;
}

/* ... (mantener estilos anteriores de body, layout y card) ... */

body {
  font-family: 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.main-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 1000px;
  justify-content: center;
}

.card {
  background: var(--card);
  padding: 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
  flex: 1;
  min-width: 320px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

/* Formulario */
input,
.form-textarea,
.json-textarea {
  width: 100%;
  padding: 12px;
  margin: 10px 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: white;
  box-sizing: border-box;
}

.form-textarea {
  height: 100px;
  resize: vertical;
  font-family: inherit;
}

.json-textarea {
  height: 120px;
  background: #020617;
  color: var(--success);
  font-family: monospace;
  font-size: 0.8rem;
  border-color: var(--success);
}

/* Contenedor para el título y el botón */
.card-header {
  display: flex;
  justify-content: space-between;
  /* Empuja el botón a la derecha */
  align-items: center;
  margin-bottom: 15px;
}

.card-header h3 {
  margin: 0;
  /* Quitamos márgenes para que no desalinee el botón */
}

/* Estilo del botón Limpiar */
.btn-clear {
  background: var(--success);
  color: white;
  padding: 8px 24px;
  font-size: 0.75rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: background 0.3s;
}

.btn-clear:hover {
  background: #ef4444;
  /* Cambia a rojo al pasar el mouse (aviso de borrado) */
}

.input-wrapper {
  margin-top: 20px;
}

.label-hint {
  font-size: 0.85rem;
  color: #94a3b8;
  display: block;
}

/* ... (resto de tus estilos de botones, salt-vault y json-textarea) ... */

.label-hint {
  font-size: 0.85rem;
  color: #94a3b8;
  display: block;
  margin-bottom: 5px;
}

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

button {
  padding: 12px;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
}

.btn-main {
  background: var(--success);
  color: white;
  width: 100%;
  margin-bottom: 10px;
}

.btn-copy {
  background: #475569;
  color: white;
  flex: 1;
}

.btn-decrypt {
  background: #1d4ed8;
  color: white;
  width: 100%;
}

.master-toggle-container {
  margin-top: 10px;
  background: rgba(0, 0, 0, 0.4);
  padding: 10px;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border);
}

.master-code {
  color: var(--accent);
  font-family: monospace;
  font-size: 1rem;
  margin-left: 10px;
}

button:hover {
  opacity: 0.8;
}

.copied {
  background: var(--success) !important;
}

/* Estilo para el visor de JSON */
.json-textarea {
  width: 100%;
  height: 120px;
  background: #020617;
  color: var(--success);
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.75rem;
  border: 1px solid #166534;
  border-radius: 4px;
  padding: 10px;
  margin-top: 10px;
  resize: none;
  /* Evita que el usuario deforme el cuadro */
  box-sizing: border-box;
}

th,
tr {
  min-width: 100px;
  text-align: left;
  font-size: 16px;
}

/* Tablas con soporte para texto largo */
td {
  padding: 10px 0;
  border-bottom: 1px solid #334155;
  word-break: break-word;
  /* Crucial para los 5000 caracteres */
  vertical-align: top;
  font-size: 14px;
}

/* Scrollbar personalizada para el área de texto */
.json-textarea::-webkit-scrollbar {
  width: 6px;
}

.json-textarea::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 10px;
}

/* Añadir esto al final de styles.css */
input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 5px rgba(56, 189, 248, 0.3);
}

/* Estilo para cuando el campo es inválido mientras se escribe (opcional) */
input:invalid:not(:placeholder-shown) {
  border-color: #ef4444;
  /* Rojo suave */
}