/* ============================================================
   KIT IA LEADER ADESIMAN — Responsive Stylesheet
   Breakpoints:
     sm  ≥ 480px   phones landscape
     md  ≥ 640px   large phones / small tablets
     lg  ≥ 768px   tablets
     xl  ≥ 1024px  desktop
     2xl ≥ 1280px  wide desktop
   ============================================================ */

/* ── Custom Font ─────────────────────────────────────────── */
@font-face {
  font-family: 'PPAgrandr';
  src: url('../fonts/PPAgrandr-GrandLight.woff2') format('woff2'),
       url('../fonts/PPAgrandr-GrandLight.woff')  format('woff'),
       url('../fonts/PPAgrandr-GrandLight.ttf')   format('truetype');
  font-weight: 100 900;   /* cubre todos los pesos con el archivo GrandLight */
  font-style: normal;
  font-display: swap;
}

:root {
  --orange:       #e8821e;
  --green-dark:   #2e5c36;
  --green-mid:    #4a8c55;
  --green-light:  #6ab472;
  --green-btn:    #4a7c59;
  --green-border: #5a9464;
  --text-dark:    #1a2e1d;
  --text-mid:     #3d5140;
  --text-muted:   #6b7a6d;
  --bg:           #ffffff;
  --bg-section:   #f6f9f6;
  --border:       #cddacc;
  --shadow-sm:    0 1px 4px rgba(0,0,0,0.07);
  --shadow:       0 2px 12px rgba(0,0,0,0.10);
  --shadow-hover: 0 6px 24px rgba(0,0,0,0.16);
  --radius:       16px;
  --radius-btn:   100px;
  --ease:         0.18s ease;

  /* Fluid spacing scale */
  --space-xs:  clamp(8px,  1.5vw, 12px);
  --space-sm:  clamp(12px, 2vw,   16px);
  --space-md:  clamp(16px, 2.5vw, 24px);
  --space-lg:  clamp(24px, 4vw,   40px);
  --space-xl:  clamp(32px, 5vw,   56px);
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'PPAgrandr', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text-dark);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ── Header ─────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  /* Limitar altura máxima en móvil para ceder espacio a los botones */
  max-height: clamp(52px, 14vw, 90px);
  overflow: hidden;
  display: flex;
  align-items: center;
}

.header-img {
  width: 100%;
  height: clamp(52px, 14vw, 90px);
  display: block;
  /* Imagen muy apaisada (4167×625) — cover centra sin dejar franjas */
  object-fit: cover;
  object-position: center center;
}

/* En tablet y desktop la cabecera puede ser más generosa */
@media (min-width: 768px) {
  .app-header {
    max-height: clamp(80px, 11vw, 130px);
  }
  .header-img {
    height: clamp(80px, 11vw, 130px);
    object-fit: contain;   /* En pantalla grande se ve completa */
  }
}

.settings-btn {
  position: absolute;
  top: 50%;
  right: clamp(10px, 2vw, 20px);
  transform: translateY(-50%);
  width: clamp(36px, 5vw, 44px);
  height: clamp(36px, 5vw, 44px);
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  color: var(--green-dark);
  transition: background var(--ease), transform var(--ease);
  flex-shrink: 0;
}
.settings-btn svg {
  width: clamp(18px, 2.5vw, 22px);
  height: clamp(18px, 2.5vw, 22px);
}
.settings-btn:hover {
  background: #fff;
  transform: translateY(-50%) rotate(30deg);
}
.settings-btn:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

/* ── Main container ─────────────────────────────────────── */
.app-main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-md) var(--space-md) var(--space-xl);
}

/* ── Welcome ─────────────────────────────────────────────── */
.welcome {
  text-align: center;
  margin-bottom: var(--space-lg);
  padding: 0 var(--space-sm);
}

.welcome-title {
  font-size: clamp(1.15rem, 3.5vw, 1.75rem);
  font-weight: 400;
  color: var(--text-dark);
  margin-bottom: var(--space-xs);
  letter-spacing: -0.02em;
}

.welcome-subtitle {
  font-size: clamp(0.82rem, 1.8vw, 0.95rem);
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Section ─────────────────────────────────────────────── */
.task-section {
  margin-bottom: var(--space-lg);
}

.section-title {
  font-size: clamp(0.9rem, 2.2vw, 1.1rem);
  font-weight: 400;
  color: var(--text-mid);
  margin-bottom: var(--space-sm);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--bg-section);
  hyphens: auto;
  overflow-wrap: break-word;
}
.section-title strong {
  font-weight: 700;
  color: inherit;          /* hereda el color del título padre */
}
/* Color específico para "Tareas generales" */
.section-title--generales {
  color: #365759;
}
/* Color específico para "Moderación de costes" */
.section-title--moderacion {
  color: #365759;
}
/* Color específico para "Comunicación" */
.section-title--comunicacion {
  color: #365759;
}

/* ── Button Grid ─────────────────────────────────────────── */
.btn-grid {
  display: grid;
  grid-template-columns: 1fr;          /* mobile: 1 col */
  gap: clamp(8px, 1.5vw, 14px);
}

/* 2 columns from md up */
@media (min-width: 560px) {
  .btn-grid { grid-template-columns: repeat(2, 1fr); }
}

/* 2 columns stays — but at xl we can go to auto layout */
@media (min-width: 1024px) {
  .btn-grid { gap: 16px; }
}

/* ── Task Button ─────────────────────────────────────────── */
.task-btn {
  display: flex;
  align-items: center;           /* vertically center icon & text */
  gap: clamp(10px, 1.5vw, 14px);
  padding: clamp(12px, 2vw, 16px) clamp(14px, 2vw, 18px);
  min-height: 64px;              /* ensure good touch target */
  border: 2px solid var(--green-border);
  border-radius: var(--radius-btn);
  background: #fff;
  text-align: left;
  color: var(--text-dark);
  font-size: clamp(0.82rem, 1.6vw, 0.9rem);
  line-height: 1.4;
  transition:
    background var(--ease),
    box-shadow var(--ease),
    border-color var(--ease),
    transform var(--ease);
  position: relative;
  overflow: hidden;
  width: 100%;
}

.task-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--green-mid), var(--green-dark));
  opacity: 0;
  transition: opacity var(--ease);
}

@media (hover: hover) {
  .task-btn:hover {
    border-color: var(--green-dark);
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
  }
  .task-btn:hover::after { opacity: 0.05; }
}
.task-btn:active {
  transform: translateY(0) scale(0.99);
  box-shadow: var(--shadow-sm);
}
.task-btn:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

.btn-icon {
  flex-shrink: 0;
  width: clamp(34px, 5vw, 42px);
  height: clamp(34px, 5vw, 42px);
  background: transparent;
  border-radius: clamp(8px, 1.2vw, 10px);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}
.btn-icon svg {
  width: clamp(18px, 2.6vw, 22px);
  height: clamp(18px, 2.6vw, 22px);
  stroke: var(--green-dark);   /* color por defecto (sección Comunicación) */
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Íconos sección Generales → color verde-salvia */
.task-section--generales .btn-icon svg { stroke: #789970; }

/* Íconos sección Moderación → color teal */
.task-section--moderacion .btn-icon svg { stroke: #365759; }

/* Íconos sección Comunicación → color naranja-tierra */
.task-section--comunicacion .btn-icon svg { stroke: #c48144; }

.btn-text {
  flex: 1;
  position: relative;
  z-index: 1;
}
.btn-text strong {
  font-weight: 700;
  color: var(--green-dark);
}

/* Botones sección Generales → borde + fondo + strong en verde-salvia */
.task-section--generales .task-btn { border-color: #789970; background: #f4f8f3; }
.task-section--generales .btn-text strong { color: #789970; }

/* Botones sección Moderación → borde + fondo + strong en teal */
.task-section--moderacion .task-btn { border-color: #365759; background: #f2f7f7; }
.task-section--moderacion .btn-text strong { color: #365759; }

/* Botones sección Comunicación → borde + fondo + strong en naranja-tierra */
.task-section--comunicacion .task-btn { border-color: #c48144; background: #fdf6ee; }
.task-section--comunicacion .btn-text strong { color: #c48144; }

/* ── Footer ──────────────────────────────────────────────── */
.app-footer {
  background: #fff;
  border-top: 1px solid var(--border);
}
.footer-img {
  width: 100%;
  max-height: clamp(50px, 9vw, 90px);
  object-fit: contain;
  padding: clamp(4px, 1vw, 10px) clamp(12px, 3vw, 32px);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.52);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 200;
  display: flex;
  align-items: flex-end;   /* bottom sheet on mobile */
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.modal-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

/* Center on tablet+ */
@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
    padding: 16px;
  }
}

.modal {
  background: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 700px;
  max-height: 94dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateY(32px);
  transition: transform 0.26s cubic-bezier(0.34, 1.15, 0.64, 1);
  box-shadow: 0 -4px 32px rgba(0,0,0,0.18);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
/* Drag handle indicator on mobile */
.modal::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 10px auto 4px;
}
.modal-overlay.is-open .modal { transform: translateY(0); }

@media (min-width: 640px) {
  .modal {
    border-radius: var(--radius);
    max-height: 88dvh;
    transform: scale(0.96) translateY(8px);
  }
  .modal::before { display: none; }
  .modal-overlay.is-open .modal { transform: scale(1) translateY(0); }
}

.modal--settings { max-width: 620px; }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: clamp(14px, 2.5vw, 20px) clamp(16px, 3vw, 24px) 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.modal-title {
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.3;
  padding-top: 2px;
}

.modal-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-section);
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--ease), color var(--ease);
}
.modal-close:hover { background: #e2e8e3; color: var(--text-dark); }
.modal-close:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

.modal-body {
  padding: clamp(14px, 3vw, 24px);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-field {
  margin-bottom: clamp(14px, 2.5vw, 20px);
}

.form-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-field input[type="text"],
.form-field input[type="date"],
.form-field input[type="email"],
.form-field textarea,
.form-field select {
  width: 100%;
  padding: clamp(10px, 1.5vw, 13px) clamp(12px, 1.8vw, 14px);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: clamp(0.88rem, 1.6vw, 1rem);
  font-family: inherit;
  color: var(--text-dark);
  background: #fff;
  transition: border-color var(--ease), box-shadow var(--ease);
  appearance: none;
  min-height: 44px; /* touch target */
}
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(74, 140, 85, 0.15);
}

.form-field textarea {
  resize: vertical;
  min-height: 96px;
}

.form-field input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  font-size: 0.88rem;
  color: var(--text-muted);
  background: var(--bg-section);
  cursor: pointer;
  min-height: 44px;
}
.form-field input[type="file"]:hover { border-color: var(--green-mid); }

/* 2-column form layout on md+ for short field pairs */
.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 clamp(12px, 2vw, 20px);
}
@media (min-width: 560px) {
  .form-row { grid-template-columns: repeat(2, 1fr); }
}

/* Checkbox group */
.checkbox-group {
  display: flex;
  gap: clamp(10px, 2vw, 18px);
  flex-wrap: wrap;
  margin-top: 6px;
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
  min-height: 32px;
}
.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green-mid);
  cursor: pointer;
  flex-shrink: 0;
}

/* Radio group */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
@media (min-width: 560px) {
  .radio-group { flex-direction: row; gap: 20px; }
}
.radio-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  min-height: 32px;
}
.radio-item input[type="radio"] { accent-color: var(--green-mid); flex-shrink: 0; }

/* Form actions */
.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: clamp(18px, 3vw, 28px);
  padding-top: 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: clamp(11px, 1.5vw, 13px) clamp(20px, 3vw, 28px);
  min-height: 48px;
  background: linear-gradient(135deg, var(--green-mid), var(--green-dark));
  color: #fff;
  font-size: clamp(0.88rem, 1.6vw, 0.95rem);
  font-weight: 600;
  border-radius: 10px;
  transition: opacity var(--ease), transform var(--ease), box-shadow var(--ease);
  box-shadow: 0 4px 14px rgba(46,92,54,0.35);
  white-space: nowrap;
}
.btn-primary:hover { opacity: 0.91; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(46,92,54,0.40); }
.btn-primary:active { transform: none; opacity: 0.88; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: clamp(11px, 1.5vw, 13px) clamp(16px, 2.5vw, 22px);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text-mid);
  font-size: clamp(0.88rem, 1.6vw, 0.95rem);
  font-weight: 500;
  transition: background var(--ease), border-color var(--ease);
  white-space: nowrap;
}
.btn-secondary:hover { background: var(--bg-section); border-color: var(--green-border); }
.btn-secondary:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* Full-width buttons on very small screens */
@media (max-width: 400px) {
  .form-actions { flex-direction: column-reverse; }
  .btn-primary, .btn-secondary { width: 100%; }
}

/* ── Spinner ─────────────────────────────────────────────── */
.spinner {
  width: 17px;
  height: 17px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Result Box ──────────────────────────────────────────── */
.result-wrap { margin-top: 20px; }

.result-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--green-dark);
  margin-bottom: 6px;
}
.result-label.is-error { color: #b52b2b; }

.result-box {
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 0.88rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-dark);
}
.result-box.is-success { border-color: var(--green-mid); background: #eef8f0; }
.result-box.is-error   { border-color: #e05555; background: #fff5f5; color: #b52b2b; }

/* ── Result box — contenido HTML renderizado ────────────── */
/* Cuando la respuesta es HTML estructurado (informes, artículos),
   usamos esta clase para mostrar el formato correctamente */
.result-box--rendered {
  white-space: normal;
  line-height: 1.75;
}
.result-box--rendered h1,
.result-box--rendered h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 18px 0 8px;
  line-height: 1.35;
}
.result-box--rendered h1:first-child,
.result-box--rendered h2:first-child { margin-top: 0; }
.result-box--rendered h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-mid);
  margin: 14px 0 6px;
}
.result-box--rendered p {
  margin: 0 0 12px;
}
.result-box--rendered p:last-child { margin-bottom: 0; }
.result-box--rendered ul,
.result-box--rendered ol {
  padding-left: 20px;
  margin-bottom: 12px;
}
.result-box--rendered li {
  margin-bottom: 5px;
  line-height: 1.6;
}
.result-box--rendered strong { font-weight: 700; }
.result-box--rendered em    { font-style: italic; }
.result-box--rendered table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-bottom: 14px;
  overflow-x: auto;
  display: block;
}
.result-box--rendered th,
.result-box--rendered td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  white-space: normal;
}
.result-box--rendered th {
  background: var(--bg-section);
  font-weight: 700;
  white-space: nowrap;
}
.result-box--rendered a  { color: var(--green-mid); text-decoration: underline; }
.result-box--rendered hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

/* ── Facturas grid (Moderación de Costes) ───────────────── */
.facturas-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 4px;
}
@media (max-width: 640px) {
  .facturas-grid { grid-template-columns: 1fr; }
}

/* Grid de 2 columnas (Alegaciones) — colapsa a 1 col en móvil */
.facturas-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}
@media (max-width: 560px) {
  .facturas-grid--2 { grid-template-columns: 1fr; }
}
.factura-card {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg-section);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.factura-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.factura-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--green-mid);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
}
.factura-num.opt-num { background: var(--text-light); }
.factura-lbl {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.3;
}
.req-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--green-dark);
  background: #d4edda;
  border-radius: 6px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
}
.opt-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-light);
  background: #e8e8e8;
  border-radius: 6px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
}
.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1.5px dashed var(--border);
  border-radius: 9px;
  padding: 14px 8px;
  cursor: pointer;
  text-align: center;
  color: var(--text-light);
  font-size: 0.75rem;
  font-weight: 500;
  transition: border-color 0.18s, background 0.18s;
  min-height: 80px;
}
.file-drop:hover {
  border-color: var(--green-mid);
  background: #f0f8f2;
  color: var(--green-dark);
}
.file-drop svg { opacity: 0.55; }
.file-drop:hover svg { opacity: 1; }
.file-preview-info {
  font-size: 0.7rem;
  color: var(--text-light);
  line-height: 1.35;
  min-height: 14px;
}

/* ── Info badge ──────────────────────────────────────────── */
.info-badge {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #fff9ed;
  border: 1px solid #f5c97a;
  color: #7a5200;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.84rem;
  margin-bottom: clamp(14px, 2vw, 20px);
  line-height: 1.45;
}
.info-badge svg { flex-shrink: 0; margin-top: 1px; }

/* ============================================================
   SETTINGS FORM
   ============================================================ */
.settings-desc {
  font-size: 0.86rem;
  color: var(--text-mid);
  margin-bottom: clamp(14px, 2.5vw, 22px);
  line-height: 1.6;
  background: #f0f8f2;
  border-left: 3px solid var(--green-mid);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
}

.settings-form .settings-group {
  margin-bottom: clamp(16px, 3vw, 24px);
}
.settings-form .settings-group h4 {
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

/* 2-column webhook inputs on md+ */
.settings-fields-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 560px) {
  .settings-fields-grid { grid-template-columns: repeat(2, 1fr); }
}

.settings-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-mid);
}
.settings-form input[type="url"] {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  color: var(--text-dark);
  transition: border-color var(--ease), box-shadow var(--ease);
  width: 100%;
  min-height: 40px;
  background: var(--bg-section);
}
.settings-form input[type="url"]:focus {
  outline: none;
  border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(74,140,85,0.15);
  background: #fff;
}
.settings-form input[type="url"]::placeholder { color: #aabdac; font-size: 0.75rem; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: clamp(16px, 4vw, 28px);
  left: 50%;
  transform: translateX(-50%) translateY(72px);
  background: #1a2e1d;
  color: #fff;
  padding: 12px clamp(18px, 3vw, 26px);
  border-radius: 100px;
  font-size: clamp(0.82rem, 1.6vw, 0.9rem);
  font-weight: 500;
  z-index: 999;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34,1.15,0.64,1), opacity 0.25s ease;
  pointer-events: none;
  max-width: min(90vw, 420px);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.toast--error   { background: #b52b2b; }
.toast.toast--success { background: var(--green-dark); }
@media (max-width: 480px) {
  .toast {
    white-space: normal;
    max-width: 88vw;
    font-size: 0.8rem;
    padding: 10px 16px;
    line-height: 1.4;
    text-align: center;
  }
}

/* ============================================================
   MOBILE-SPECIFIC COMPACTING  (≤ 639px)
   Reducir espacios para que los botones dispongan de más área
   ============================================================ */
@media (max-width: 639px) {
  .app-main {
    padding: 10px 12px 16px;
  }

  /* Welcome: más compacto */
  .welcome {
    margin-bottom: 10px;
    padding: 0;
  }
  .welcome-title {
    font-size: 1rem;
    margin-bottom: 4px;
  }
  .welcome-subtitle {
    font-size: 0.78rem;
    line-height: 1.45;
  }

  /* Secciones: separación más ajustada */
  .task-section {
    margin-bottom: 12px;
  }
  .section-title {
    font-size: 0.8rem;
    margin-bottom: 7px;
    padding-bottom: 5px;
  }

  /* Botones: un poco más bajos para que entren más en pantalla */
  .btn-grid {
    gap: 7px;
  }
  .task-btn {
    min-height: 52px;
    padding: 9px 12px;
    gap: 10px;
    font-size: 0.81rem;
  }
  .btn-icon {
    width: 30px;
    height: 30px;
  }
  .btn-icon svg {
    width: 17px;
    height: 17px;
  }
}

/* ============================================================
   DESKTOP-SPECIFIC ENHANCEMENTS  (≥ 1024px)
   ============================================================ */
@media (min-width: 1024px) {
  .app-main {
    padding-top: 36px;
    padding-bottom: 60px;
    /* Wider side padding so content doesn't hug the edge */
    padding-left: clamp(24px, 5vw, 80px);
    padding-right: clamp(24px, 5vw, 80px);
  }

  /* Títulos SIEMPRE encima de sus botones (no sidebar) */
  .task-section {
    display: block;
    margin-bottom: 36px;
  }

  .section-title {
    border-bottom: 2px solid var(--bg-section);
    border-right: none;
    padding-right: 0;
    padding-bottom: 8px;
    margin-bottom: var(--space-sm);
    font-size: 1.05rem;
  }

  .btn-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Taller buttons on desktop */
  .task-btn {
    min-height: 72px;
    padding: 18px 20px;
    font-size: 0.92rem;
  }
}
