/* Guía del Técnico — Refrigeración. Tema oscuro (uso en campo).
   Paleta Tegewa: carbón #0F172A / #1E293B + naranja #F97316. */

:root {
  color-scheme: dark;
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #12192b;
  --border: #2a3346;
  --accent: #f97316;
  --accent-soft: #fb923c;
  --text: #f8fafc;
  --muted: #94a3b8;
  --warning: #fbbf24;
  --danger: #f87171;
  --ok: #34d399;
  --liquid: #38bdf8;
  --safe-max: 620px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  max-width: var(--safe-max);
  margin: 0 auto;
  padding: 0 12px calc(76px + env(safe-area-inset-bottom));
  -webkit-text-size-adjust: 100%;
}

/* Header */
.app-header {
  padding: 14px 4px 10px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--accent);
  color: #0f172a;
  font-weight: 900;
  font-size: 0.85rem;
}

.brand-name {
  font-weight: 800;
  letter-spacing: 0.22em;
  font-size: 0.82rem;
}

.brand-kicker {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.app-header h1 {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
}

.app-header h1 span {
  display: block;
  color: var(--accent-soft);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* Disclaimer */
.disclaimer {
  margin: 10px 0;
  padding: 9px 12px;
  background: #2a2410;
  border: 1px solid #55461c;
  border-left: 4px solid var(--warning);
  border-radius: 8px;
  font-size: 0.78rem;
  color: #fde9c8;
}

/* Vistas */
.view { display: none; }
.view.is-active { display: block; }

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.card h2 {
  font-size: 1.05rem;
  margin-bottom: 6px;
}

/* Selector de gas */
.gas-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}

.gas-group-label {
  width: 100%;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.gas-group-label:first-child { margin-top: 0; }

.btn-gas {
  flex: 1 1 auto;
  min-width: 84px;
  padding: 9px 8px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}

.btn-gas.is-active {
  border-color: var(--accent);
  background: #f973161f;
  color: var(--accent-soft);
}

/* Manómetro */
.gauge { text-align: center; padding: 12px 10px 6px; }

.gauge-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}

.gauge-svg { width: 100%; max-width: 260px; height: auto; }

.gauge-tick {
  fill: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
}

#needle {
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.gauge-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent-soft);
  margin-top: -4px;
}

/* Ficha */
.ficha-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.ficha-head h2 { font-size: 1.1rem; }

.badge {
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
  background: #334155;
  color: var(--text);
}

.badge.is-a3 { background: #7f1d1d; color: #fecaca; }
.badge.is-a2l { background: #78350f; color: #fde68a; }
.badge.is-a1 { background: #14532d; color: #bbf7d0; }

.ficha-warn {
  margin-bottom: 10px;
  padding: 8px 10px;
  background: #2a2410;
  border-left: 4px solid var(--warning);
  border-radius: 6px;
  font-size: 0.78rem;
  color: #fde9c8;
}

/* Panel destacado de carga */
.carga-panel {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px;
  background: #12233b;
  border: 1px solid var(--border);
  border-left: 5px solid var(--accent);
  border-radius: 10px;
}

.carga-visual {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--accent-soft);
}

.carga-cil {
  width: 40px;
  height: 64px;
  transition: transform 0.35s ease;
}

.carga-cil.is-invertida { transform: rotate(180deg); }

.carga-cil.is-gaseosa .carga-fill { opacity: 0.12; }

.carga-flow {
  margin-top: 2px;
  font-size: 0.9rem;
  color: var(--accent-soft);
  line-height: 1;
}

.carga-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }

.carga-orient {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.carga-fase {
  font-size: 0.82rem;
  font-weight: 700;
}

.carga-fase.is-liquida { color: var(--liquid); }
.carga-fase.is-gaseosa { color: var(--muted); }

.carga-balanza {
  align-self: flex-start;
  margin-top: 2px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #78350f;
  color: #fde68a;
  font-size: 0.72rem;
  font-weight: 800;
}

.carga-detalle {
  margin-top: 4px;
  font-size: 0.78rem;
  color: #cbd5e1;
}

.ficha-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 9px;
  min-width: 0;
}

.box--wide { grid-column: 1 / -1; }

.box-lbl {
  display: block;
  font-size: 0.64rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.box-val {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  word-break: break-word;
}

.note-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  padding: 10px;
  font-size: 0.82rem;
  color: #e2e8f0;
}

/* Tablas */
.tabla { width: 100%; border-collapse: collapse; font-size: 0.86rem; margin-top: 6px; }
.tabla td { padding: 8px 6px; border-bottom: 1px solid var(--border); }
.tabla tr td:last-child { text-align: right; font-weight: 700; color: var(--accent-soft); white-space: nowrap; }
.tabla tr:last-child td { border-bottom: none; }

.muted-sm { font-size: 0.76rem; color: var(--muted); }

.fuentes { list-style: none; }
.fuentes li { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 0.84rem; }
.fuentes li:last-child { border-bottom: none; }
.fuentes a { color: var(--accent-soft); word-break: break-all; }

/* Nav inferior */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--safe-max);
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 50;
}

.nav-btn {
  flex: 1;
  background: none;
  border: none;
  border-top: 2px solid transparent;
  color: var(--muted);
  padding: 13px 0;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.nav-btn.is-active {
  color: var(--accent-soft);
  border-top-color: var(--accent);
}

[hidden] { display: none !important; }
