:root {
  --bg: #f4f6f9;
  --card: #fff;
  --text: #1a1d23;
  --muted: #5c6578;
  --border: #d8dee9;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --error: #b91c1c;
  --error-bg: #fef2f2;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.flash-messages {
  list-style: none;
  margin: 0;
  padding: 0.75rem 1rem;
}

.flash {
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

.flash-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid #fecaca;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.login-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
}

.subtitle {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 1rem;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.top-bar h1 {
  margin: 0;
  font-size: 1.2rem;
}

.editor-form {
  padding: 1rem 1.25rem 1.5rem;
}

.instrucciones {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(99, 102, 241, 0.1));
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-left: 5px solid #3b82f6;
  border-radius: var(--radius);
  padding: 1rem 1.25rem 1.1rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.08);
}

.instrucciones-titulo {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  color: #1e40af;
}

.instrucciones-lista {
  margin: 0;
  padding-left: 1.35rem;
  display: grid;
  gap: 0.55rem;
}

.instrucciones-lista li {
  padding-left: 0.15rem;
}

.instrucciones-lista code {
  font-size: 0.85em;
  background: rgba(255, 255, 255, 0.65);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.instrucciones-nota {
  margin: 0.85rem 0 0;
  padding: 0.65rem 0.85rem;
  background: rgba(251, 191, 36, 0.18);
  border-radius: 6px;
  font-size: 0.9rem;
  color: #78350f;
}

.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 900px) {
  .panels {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.panel-header h2 {
  margin: 0;
  font-size: 1rem;
}

textarea {
  flex: 1;
  width: 100%;
  border: none;
  padding: 1rem;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  resize: vertical;
  min-height: 360px;
  border-radius: 0 0 var(--radius) var(--radius);
}

.textarea-entrada {
  background-color: rgba(250, 204, 21, 0.14);
}

.textarea-entrada:focus {
  background-color: rgba(250, 204, 21, 0.2);
}

.textarea-limpio {
  background-color: rgba(34, 197, 94, 0.14);
}

.textarea-limpio:focus {
  background-color: rgba(34, 197, 94, 0.2);
}

.panel-entrada {
  border-color: rgba(250, 204, 21, 0.45);
}

.panel-salida {
  border-color: rgba(34, 197, 94, 0.45);
}

textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #e8ecf3;
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: #d8dee9;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.login-card .btn-primary {
  width: 100%;
  margin-top: 0.5rem;
}
