/* Verigas v0.1 — Componentes */

/* Cards */
.card {
  background: var(--gris-0);
  border-radius: var(--radio-card);
  box-shadow: var(--sombra-card);
  padding: var(--sp-6);
}
.card-kpi {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--verde-50) 0%, var(--gris-0) 60%);
}
.card-kpi.has-spark { padding-bottom: 56px; }
.card-kpi .kpi-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--verde-100); color: var(--verde-700);
  margin-bottom: var(--sp-4);
}
.card-kpi .kpi-value { font-family: var(--font-head); font-weight: 700; font-size: var(--t-40); letter-spacing: -0.02em; line-height: 1.1; margin-bottom: 2px; }
.card-kpi .kpi-label { color: var(--gris-600); font-size: var(--t-14); }
.card-kpi .kpi-spark-area { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 52px; }
.card-kpi .row-between { position: relative; z-index: 1; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: var(--t-12); font-weight: 600; }
.delta.up { color: var(--verde-600); }
.delta.down { color: var(--naranja-500); }

/* Botones */
.btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-body); font-size: var(--t-14); font-weight: 600;
  padding: 12px 20px; border-radius: var(--radio-input);
  border: 1px solid transparent; cursor: pointer; transition: .15s ease;
  text-decoration: none; line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--verde-500); color: #fff; }
.btn-primary:hover { background: var(--verde-600); }
.btn-primary:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--verde-200); }
.btn-secondary { background: var(--gris-0); border-color: var(--gris-200); color: var(--gris-900); }
.btn-secondary:hover { background: var(--gris-50); }
.btn-danger { background: var(--rojo-500); color: #fff; }
.btn-ghost { background: transparent; color: var(--gris-600); }
.btn-ghost:hover { background: var(--gris-100); }
.btn-sm { padding: 8px 14px; font-size: var(--t-12); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Inputs */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-4); }
.field label { font-size: var(--t-12); font-weight: 600; color: var(--gris-600); }
.input, select.input, textarea.input {
  width: 100%; font-family: var(--font-body); font-size: var(--t-14); color: var(--gris-900);
  border: 1px solid var(--gris-200); border-radius: var(--radio-input);
  padding: 12px 16px; background: var(--gris-0); transition: .15s;
}
.input:focus, select.input:focus, textarea.input:focus {
  outline: none; border-color: var(--verde-500); box-shadow: 0 0 0 3px var(--verde-50);
}
textarea.input { resize: vertical; min-height: 80px; }

/* Selects: ocultamos la flecha nativa y dibujamos una propia con espacio a la derecha. */
select.input {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding-right: 42px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23566159' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 16px 16px;
}
html[data-theme="dark"] select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239DACA3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
/* En modo oscuro, las opciones desplegadas heredan colores legibles. */
html[data-theme="dark"] select.input option { background: var(--gris-0); color: var(--gris-900); }

/* Pills / badges */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--t-12); font-weight: 600; padding: 4px 10px; border-radius: var(--radio-pill);
  background: var(--verde-50); color: var(--verde-700);
}
.pill.gris { background: var(--gris-100); color: var(--gris-600); }
.pill.naranja { background: #FFF1E6; color: var(--naranja-500); }
.pill.rojo { background: #FEECEC; color: var(--rojo-500); }
.pill.azul { background: #EAF2FE; color: #2563EB; }

/* Estado badges por estado de solicitud */
.estado-recibida { background: var(--gris-100); color: var(--gris-600); }
.estado-asignada { background: #EAF2FE; color: #2563EB; }
.estado-en_proceso { background: #FFF7E6; color: #B45309; }
.estado-cerrada { background: var(--verde-50); color: var(--verde-700); }

/* Tablas */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: var(--t-12); font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--gris-600); padding: 12px 16px; border-bottom: 1px solid var(--gris-200);
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--gris-100); font-size: var(--t-14); }
.table tbody tr:hover { background: var(--gris-50); }
.table tbody tr:last-child td { border-bottom: none; }

/* Avatar iniciales */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 600; font-size: var(--t-14);
  background: var(--verde-100); color: var(--verde-700);
}

/* Modales */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(17,24,39,.45);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: var(--sp-4);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--gris-0); border-radius: var(--radio-card); box-shadow: var(--sombra-pop);
  width: 100%; max-width: 520px; padding: var(--sp-8); max-height: 90vh; overflow: auto;
}
.modal-lg { max-width: 920px; }

/* Alert */
.alert { padding: 12px 16px; border-radius: var(--radio-input); font-size: var(--t-14); margin-bottom: var(--sp-4); }
.alert-error { background: #FEECEC; color: #B91C1C; }
.alert-ok { background: var(--verde-50); color: var(--verde-700); }
.alert-warn { background: #FFF7E6; color: #B45309; }

/* Sello de integridad */
.seal-box {
  background: var(--verde-50); border: 1px solid var(--verde-200); border-radius: var(--radio-input);
  padding: var(--sp-4); display: flex; align-items: center; gap: var(--sp-3); color: var(--verde-700);
}
.seal-hash { font-family: var(--font-body); font-size: var(--t-12); word-break: break-all; color: var(--verde-700); }

.divider { height: 1px; background: var(--gris-100); margin: var(--sp-6) 0; }
.hidden { display: none !important; }
