/* ── shadcn/ui Design System ─────────────────────────────────────────────────
   Basado en las variables y tokens de diseño de https://ui.shadcn.com
   Tema: Dark (zinc)
   ────────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── CSS Variables (shadcn tokens) ──────────────────────────────────────── */
:root {
  --background: 240 10% 3.9%;
  --foreground: 0 0% 98%;
  --card: 240 10% 3.9%;
  --card-foreground: 0 0% 98%;
  --popover: 240 10% 3.9%;
  --popover-foreground: 0 0% 98%;
  --primary: 0 0% 98%;
  --primary-foreground: 240 5.9% 10%;
  --secondary: 240 3.7% 15.9%;
  --secondary-foreground: 0 0% 98%;
  --muted: 240 3.7% 15.9%;
  --muted-foreground: 240 5% 64.9%;
  --accent: 240 3.7% 15.9%;
  --accent-foreground: 0 0% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 3.7% 15.9%;
  --input: 240 3.7% 15.9%;
  --ring: 240 4.9% 83.9%;
  --radius: 0.5rem;

  /* Colores adicionales */
  --success: 142 76% 36%;
  --success-foreground: 0 0% 98%;
  --warning: 38 92% 50%;
  --warning-foreground: 0 0% 9%;
  --info: 217 91% 60%;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}


/* ── Modal Overlay ──────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }


/* ── Card ───────────────────────────────────────────────────────────────── */
.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  overflow: hidden;
  animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card-header {
  padding: 24px 24px 0;
}
.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: hsl(var(--foreground));
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-description {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin-top: 4px;
}
.card-content {
  padding: 24px;
}
.card-footer {
  padding: 0 24px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}


/* ── Login Card ─────────────────────────────────────────────────────────── */
.login-card {
  width: 100%;
  max-width: 400px;
}
.login-card .card-header {
  text-align: center;
  padding: 32px 24px 0;
}
.login-card .card-title {
  font-size: 1.5rem;
  justify-content: center;
}
.login-card .card-description {
  margin-top: 8px;
}

.login-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  background: hsl(var(--secondary));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}


/* ══════════════════════════════════════════════════════════════════════════
   NUEVO: Casilla "Recuérdame"
   ══════════════════════════════════════════════════════════════════════════ */
.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.remember-me input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: hsl(var(--primary));
  cursor: pointer;
}
.remember-me label {
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  font-weight: 400;
}


/* ══════════════════════════════════════════════════════════════════════════
   NUEVO: Desplegable de cuentas guardadas
   ══════════════════════════════════════════════════════════════════════════
   Aparece debajo del campo "Usuario" en el login.
   Muestra una lista de cuentas que el usuario guardó con "Recuérdame".
*/

/* Wrapper del campo usuario para que el desplegable se posicione relativo a él */
.form-group-username-wrap {
  position: relative;
}

.saved-accounts-dropdown {
  display: none;
  position: absolute;
  top: 100%;           /* Justo debajo del campo de texto */
  left: 0;
  right: 0;
  z-index: 100;
  background: hsl(240 6% 8%);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  margin-top: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
}

.saved-accounts-dropdown.visible {
  display: block;
  animation: dropdownFadeIn 0.15s ease-out;
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.saved-accounts-header {
  padding: 8px 12px;
  font-size: 0.7rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid hsl(var(--border));
}

.saved-account-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid hsl(var(--border) / 0.5);
}

.saved-account-item:last-child {
  border-bottom: none;
}

.saved-account-item:hover {
  background: hsl(var(--secondary));
}

/* Avatar circular con la inicial del nombre */
.saved-account-avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  background: hsl(var(--info) / 0.2);
  color: hsl(var(--info));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
}

.saved-account-info {
  flex: 1;
  min-width: 0;   /* Para que el text-overflow funcione */
}

.saved-account-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-account-user {
  font-size: 0.72rem;
  color: hsl(var(--muted-foreground));
}

/* Botón × para eliminar una cuenta del historial */
.saved-account-remove {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: hsl(var(--muted-foreground));
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-family: inherit;
}

.saved-account-remove:hover {
  background: hsl(var(--destructive) / 0.2);
  color: hsl(0 86% 70%);
}


/* ══════════════════════════════════════════════════════════════════════════
   NUEVO: Modal de selección de tipo (Acreedor / Proveedor)
   ══════════════════════════════════════════════════════════════════════════ */
.tipo-card {
  width: 100%;
  max-width: 520px;
}

.tipo-info {
  font-size: 0.9rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.6;
  margin-bottom: 20px;
  text-align: center;
}

.tipo-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tipo-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 16px;
  background: hsl(var(--secondary) / 0.5);
  border: 2px solid hsl(var(--border));
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  color: hsl(var(--foreground));
  transition: all 0.2s;
  text-align: center;
}

.tipo-option:hover {
  border-color: hsl(var(--ring));
  background: hsl(var(--secondary));
  transform: translateY(-2px);
}

.tipo-option-icon {
  font-size: 2rem;
  margin-bottom: 4px;
}

.tipo-option-title {
  font-size: 1rem;
  font-weight: 600;
}

.tipo-option-desc {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.4;
}


/* ══════════════════════════════════════════════════════════════════════════
   NUEVO: Badge de tipo en el modal SOLID
   ══════════════════════════════════════════════════════════════════════════ */
.tipo-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tipo-proveedor {
  background: hsl(var(--info) / 0.15);
  border: 1px solid hsl(var(--info) / 0.3);
  color: hsl(217 91% 70%);
}

.tipo-acreedor {
  background: hsl(280 60% 40% / 0.15);
  border: 1px solid hsl(280 60% 40% / 0.3);
  color: hsl(280 60% 70%);
}


/* ── SOLID Modal ────────────────────────────────────────────────────────── */
.solid-card {
  width: 100%;
  max-width: 480px;
}

.solid-info {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.6;
  margin-bottom: 20px;
}

.solid-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.solid-warning {
  font-size: 0.8rem;
  color: hsl(var(--warning));
  background: hsl(var(--warning) / 0.1);
  border: 1px solid hsl(var(--warning) / 0.2);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.solid-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}


/* ══════════════════════════════════════════════════════════════════════════
   NUEVO: Mensajes de estado del NIF
   ══════════════════════════════════════════════════════════════════════════
   Estos estilos dan formato al mensaje que aparece debajo del campo
   CIF/NIF del emisor. Hay tres estados:
   - .nif-ok       → Verde: el NIF existe en la BD
   - .nif-error    → Rojo: el NIF NO existe en la BD
   - .nif-checking → Gris: verificando...
*/
.nif-status {
  font-size: 0.78rem;
  line-height: 1.4;
  min-height: 0;
  transition: all 0.2s;
  margin-top: 4px;
}

.nif-status:empty {
  display: none;
}

.nif-ok {
  color: hsl(142 76% 55%);
  padding: 6px 10px;
  background: hsl(var(--success) / 0.08);
  border: 1px solid hsl(var(--success) / 0.2);
  border-radius: calc(var(--radius) - 2px);
}

.nif-error {
  color: hsl(0 86% 68%);
  padding: 6px 10px;
  background: hsl(var(--destructive) / 0.08);
  border: 1px solid hsl(var(--destructive) / 0.2);
  border-radius: calc(var(--radius) - 2px);
}

.nif-checking {
  color: hsl(var(--muted-foreground));
  padding: 6px 10px;
  background: hsl(var(--secondary) / 0.5);
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
}


/* ── Form Controls ──────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group + .form-group {
  margin-top: 16px;
}

label {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}

input, textarea, select {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.875rem;
  font-family: inherit;
  color: hsl(var(--foreground));
  background: transparent;
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 2px);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder {
  color: hsl(var(--muted-foreground));
}
input:focus, textarea:focus, select:focus {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}
input:read-only {
  opacity: 0.7;
  cursor: default;
}
textarea {
  resize: vertical;
  min-height: 64px;
  line-height: 1.5;
}
input[type="file"] { display: none; }


/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  border-radius: calc(var(--radius) - 2px);
  border: none;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
  line-height: 1.25rem;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}
.btn-primary:hover:not(:disabled) { opacity: 0.9; }

.btn-secondary {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}
.btn-secondary:hover:not(:disabled) { background: hsl(240 3.7% 20%); }

.btn-destructive {
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}
.btn-destructive:hover:not(:disabled) { opacity: 0.9; }

.btn-outline {
  background: transparent;
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--input));
}
.btn-outline:hover:not(:disabled) {
  background: hsl(var(--accent));
}

.btn-ghost {
  background: transparent;
  color: hsl(var(--foreground));
}
.btn-ghost:hover:not(:disabled) {
  background: hsl(var(--accent));
}

.btn-success {
  background: hsl(var(--success));
  color: hsl(var(--success-foreground));
}
.btn-success:hover:not(:disabled) { opacity: 0.9; }

.btn-warning {
  background: hsl(var(--warning));
  color: hsl(var(--warning-foreground));
  font-weight: 600;
}
.btn-warning:hover:not(:disabled) { opacity: 0.9; }

.btn-full { width: 100%; }

.btn-lg {
  padding: 10px 20px;
  font-size: 0.925rem;
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
}


/* ── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 16px;
  border: 1px solid;
}
.alert-error {
  background: hsl(var(--destructive) / 0.15);
  border-color: hsl(var(--destructive) / 0.3);
  color: hsl(0 86% 70%);
}
.alert-warning {
  background: hsl(var(--warning) / 0.1);
  border-color: hsl(var(--warning) / 0.25);
  color: hsl(38 92% 65%);
}
.alert-success {
  background: hsl(var(--success) / 0.15);
  border-color: hsl(var(--success) / 0.3);
  color: hsl(142 76% 60%);
}


/* ── Spinner ────────────────────────────────────────────────────────────── */
.spinner-wrap {
  display: none;
  justify-content: center;
  padding: 12px 0;
}
.spinner-wrap.active { display: flex; }

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

.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

.progress {
  height: 2px;
  background: hsl(var(--secondary));
  border-radius: 1px;
  margin-top: 16px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: hsl(var(--destructive));
  border-radius: 1px;
  transition: width 0.3s;
}

.text-muted {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  text-align: center;
  margin-top: 16px;
}


/* ── Main Layout ────────────────────────────────────────────────────────── */
.app-container {
  display: none;
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 16px;
}
.app-container.visible { display: block; }


/* ── App Header ─────────────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  margin-bottom: 24px;
  border-bottom: 1px solid hsl(var(--border));
}
.app-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.app-header-title {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.app-header-subtitle {
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
}
.app-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-badge {
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
  padding: 4px 10px;
  background: hsl(var(--secondary));
  border-radius: calc(var(--radius) - 2px);
}
.btn-logout {
  font-size: 0.8rem;
  padding: 4px 12px;
  background: transparent;
  color: hsl(var(--muted-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-logout:hover {
  background: hsl(var(--destructive) / 0.15);
  border-color: hsl(var(--destructive) / 0.3);
  color: hsl(0 86% 70%);
}


/* ── Badge ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  border: 1px solid transparent;
}
.badge-outline {
  border-color: hsl(var(--border));
  color: hsl(var(--foreground));
}
.badge-success {
  background: hsl(var(--success) / 0.15);
  border-color: hsl(var(--success) / 0.3);
  color: hsl(142 76% 60%);
}


/* ── Features Section ───────────────────────────────────────────────────── */
.features-card {
  margin-bottom: 24px;
}
.features-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
}
.features-list li {
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
  padding: 6px 0 6px 24px;
  position: relative;
  line-height: 1.4;
}
.features-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: hsl(var(--success));
  font-weight: 600;
}


/* ── Upload Area ────────────────────────────────────────────────────────── */
.upload-area {
  border: 2px dashed hsl(var(--border));
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.upload-area:hover {
  border-color: hsl(var(--muted-foreground));
  background: hsl(var(--secondary) / 0.5);
}
.upload-area.dragover {
  border-color: hsl(var(--ring));
  background: hsl(var(--ring) / 0.05);
}
.upload-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  background: hsl(var(--secondary));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}
.upload-area h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.upload-area p {
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 16px;
}


/* ── File Info ──────────────────────────────────────────────────────────── */
.file-info {
  display: none;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}
.file-info.active { display: block; }
.file-info p {
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 4px;
}
.file-info strong {
  color: hsl(var(--foreground));
}
.file-info-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}


/* ── Loading ────────────────────────────────────────────────────────────── */
.loading {
  display: none;
  text-align: center;
  padding: 48px 0;
}
.loading.active { display: block; }
.loading p {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin-top: 12px;
}


/* ── Data Editor ────────────────────────────────────────────────────────── */
.data-editor {
  display: none;
  margin-top: 24px;
}
.data-editor.active { display: block; }

.editor-header {
  margin-bottom: 20px;
}
.editor-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.editor-header p {
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
  margin-top: 4px;
}

.form-section {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.form-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid hsl(var(--border));
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.form-grid .form-group {
  margin-top: 0;
}
.form-group-full {
  grid-column: 1 / -1;
}
/* NUEVO: Clase para que la descripción ocupe más espacio en las líneas */
.form-group-desc {
  grid-column: span 2;
}


/* ── Invoice Lines ──────────────────────────────────────────────────────── */
.line-item {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 8px;
  background: hsl(var(--secondary) / 0.3);
}
.line-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.line-item-header h5 {
  font-size: 0.85rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
}
.btn-remove-line {
  font-size: 0.75rem;
  padding: 4px 10px;
  background: hsl(var(--destructive) / 0.15);
  color: hsl(0 86% 70%);
  border: 1px solid hsl(var(--destructive) / 0.2);
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-remove-line:hover {
  background: hsl(var(--destructive) / 0.25);
}
.btn-add-line {
  font-size: 0.85rem;
  padding: 8px 16px;
  background: transparent;
  color: hsl(var(--success));
  border: 1px dashed hsl(var(--success) / 0.4);
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  margin-top: 8px;
  transition: all 0.15s;
}
.btn-add-line:hover {
  background: hsl(var(--success) / 0.1);
  border-style: solid;
}


/* ── Action Buttons ─────────────────────────────────────────────────────── */
.action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid hsl(var(--border));
}


/* ── Results / Preview ──────────────────────────────────────────────────── */
.results {
  display: none;
  margin-top: 24px;
}
.results.active { display: block; }

.result-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0;
  border-bottom: 1px solid hsl(var(--border));
}
.tab {
  padding: 10px 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  font-family: inherit;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  margin-bottom: -1px;
}
.tab.active {
  color: hsl(var(--foreground));
  border-bottom-color: hsl(var(--foreground));
}
.tab:hover {
  color: hsl(var(--foreground));
}

.tab-content {
  display: none;
  border: 1px solid hsl(var(--border));
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
}
.tab-content.active { display: block; }

pre {
  background: hsl(240 6% 6%);
  color: hsl(var(--foreground));
  padding: 16px;
  border-radius: calc(var(--radius) - 2px);
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.6;
  font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;
  tab-size: 2;
}


/* ── Error & Success Messages ───────────────────────────────────────────── */
.message-error {
  background: hsl(var(--destructive) / 0.1);
  color: hsl(0 86% 70%);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-top: 16px;
  border: 1px solid hsl(var(--destructive) / 0.2);
  font-size: 0.875rem;
}
.message-success {
  background: hsl(var(--success) / 0.1);
  color: hsl(142 76% 60%);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-top: 16px;
  border: 1px solid hsl(var(--success) / 0.2);
  font-size: 0.875rem;
}

.preview-banner {
  background: hsl(var(--secondary));
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}


/* ── Separator ──────────────────────────────────────────────────────────── */
.separator {
  height: 1px;
  background: hsl(var(--border));
  margin: 16px 0;
}


/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: hsl(var(--muted-foreground)); }


/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .app-header-right {
    width: 100%;
    justify-content: space-between;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  /* En móvil, la descripción no ocupa 2 columnas (solo hay 1) */
  .form-group-desc {
    grid-column: span 1;
  }
  .action-buttons {
    flex-direction: column;
  }
  .action-buttons .btn {
    width: 100%;
  }
  .solid-config-grid {
    grid-template-columns: 1fr;
  }
  .features-list {
    grid-template-columns: 1fr;
  }
  /* Modal de tipo: una columna en móvil */
  .tipo-options {
    grid-template-columns: 1fr;
  }
}