/* ============================================================
   qPS4 · Estilos
   Paleta armónica con ARUCIP (form.jotform.com/jorgesel/arucip
   y jselandari.github.io/calc_inotropicos)
   ============================================================ */

:root {
  --arucip-dark:       #2f4f4f;   /* verde oscuro institucional */
  --arucip-teal:       #5f8a8b;   /* teal principal */
  --arucip-teal-light: #8fb3b3;   /* teal claro (bordes) */
  --arucip-bg:         #f4f7f7;   /* fondo general */
  --arucip-card:       #ffffff;   /* fondo tarjetas */
  --arucip-red:        #c0392b;   /* rojo de acento (engranajes) */
  --arucip-text:       #1f2d2d;
  --arucip-muted:      #5a6b6b;
  --arucip-border:     #d8e3e3;

  --ok:   #2e7d32;
  --warn: #e67e22;
  --bad:  #c0392b;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  background: var(--arucip-bg);
  color: var(--arucip-text);
  line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- Header ---------- */
header {
  background: linear-gradient(135deg, var(--arucip-dark) 0%, var(--arucip-teal) 100%);
  color: #fff;
  padding: 18px 16px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 640px;
  margin: 0 auto;
}
.logo {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 50%;
  background: #fff;
  padding: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
  object-fit: contain;
}
header h1 {
  font-size: 1.05rem;
  margin: 0;
  font-weight: 700;
  letter-spacing: .2px;
}
header p {
  margin: 2px 0 0;
  font-size: .78rem;
  opacity: .9;
}

/* ---------- Layout ---------- */
main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 14px 40px;
}

.card {
  background: var(--arucip-card);
  border: 1px solid var(--arucip-border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(47, 79, 79, .06);
}
.card-flat {
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}
.card h2 {
  font-size: 1rem;
  margin: 0 0 12px;
  color: var(--arucip-dark);
  border-bottom: 2px solid var(--arucip-teal-light);
  padding-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h2 .num {
  background: var(--arucip-teal);
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  font-weight: 700;
  flex: 0 0 24px;
}

/* ---------- Formularios ---------- */
label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--arucip-dark);
  margin-bottom: 6px;
}
.hint {
  font-size: .75rem;
  color: var(--arucip-muted);
  font-weight: 400;
  margin-top: 2px;
}
input, select {
  width: 100%;
  padding: 11px 12px;
  font-size: 1rem;
  border: 1.5px solid var(--arucip-border);
  border-radius: 10px;
  background: #fff;
  color: var(--arucip-text);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--arucip-teal);
  box-shadow: 0 0 0 3px rgba(95, 138, 139, .15);
}

.row   { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 480px) {
  .row   { grid-template-columns: 1fr; }
  .row-3 { grid-template-columns: 1fr 1fr; }
}
.field { margin-bottom: 12px; }

/* ---------- TAMSI ---------- */
.tamsi-box {
  background: linear-gradient(135deg, #eef5f5, #e0eeee);
  border: 1px dashed var(--arucip-teal);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  margin-top: 8px;
}
.tamsi-box .label {
  font-size: .8rem;
  color: var(--arucip-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.tamsi-box .value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--arucip-dark);
  margin: 4px 0;
}
.tamsi-box .cut { font-size: .85rem; color: var(--arucip-muted); }
.tamsi-box.elevated {
  background: linear-gradient(135deg, #fdecea, #fadbd8);
  border-color: var(--arucip-red);
}
.tamsi-box.elevated .value { color: var(--arucip-red); }

/* ---------- Criterios ---------- */
.criteria-list { list-style: none; padding: 0; margin: 0; }
.criteria-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 12px;
  border-bottom: 1px solid var(--arucip-border);
  font-size: .9rem;
}
.criteria-list li:last-child { border-bottom: none; }
.criteria-list .name { font-weight: 600; color: var(--arucip-dark); flex: 1; }
.criteria-list .score {
  font-weight: 800;
  font-size: 1.05rem;
  min-width: 28px;
  text-align: center;
  padding: 3px 9px;
  border-radius: 8px;
}
.score.s0 { background: #e8f5e9; color: var(--ok); }
.score.s1 { background: #fdecea; color: var(--bad); }

/* ---------- Total ---------- */
.total-box {
  background: linear-gradient(135deg, var(--arucip-dark), var(--arucip-teal));
  color: #fff;
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  margin-top: 6px;
}
.total-box .label {
  font-size: .85rem;
  opacity: .9;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.total-box .score {
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 1;
  margin: 6px 0;
}
.total-box .interp {
  font-size: .95rem;
  font-weight: 600;
  margin-top: 4px;
}

/* ---------- Botones ---------- */
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: var(--arucip-red);
  color: #fff;
  transition: transform .1s, filter .15s;
  margin-top: 10px;
}
.btn:active { transform: scale(.98); }
.btn.secondary { background: var(--arucip-teal); }
.btn.ghost {
  background: #fff;
  color: var(--arucip-dark);
  border: 1.5px solid var(--arucip-border);
}

/* ---------- Textos auxiliares ---------- */
.disclaimer {
  font-size: .72rem;
  color: var(--arucip-muted);
  text-align: center;
  margin-top: 18px;
  padding: 0 8px;
  line-height: 1.5;
}
.disclaimer strong { color: var(--arucip-red); }

.ref {
  font-size: .75rem;
  color: var(--arucip-muted);
  margin-top: 8px;
  line-height: 1.5;
}
.ref a { color: var(--arucip-teal); text-decoration: none; font-weight: 600; }

.error {
  color: var(--arucip-red);
  font-size: .8rem;
  margin-top: 4px;
  display: none;
}
.error.show { display: block; }

details { margin-top: 8px; }
details summary {
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  color: var(--arucip-teal);
  padding: 8px 0;
  user-select: none;
}
details[open] summary { margin-bottom: 6px; }