/* ============================================================
   PatrolCheck — calculadora de puestos + formulario de demo.
   Lo usan la portada (#precio) y la página de precios.
   Toma los tokens de la página (--ink, --card, --paper...) con
   respaldo propio, para verse igual en ambas.
   ============================================================ */

.pc-calc,
.pc-demo {
  --c-ink: var(--ink, #15161a);
  --c-paper: var(--paper, #f0ecdf);
  --c-card: var(--card, #5d7a5e);
  --c-card-deep: var(--card-deep, #3f5540);
  --c-card-bright: var(--card-bright, #8fb591);
  --c-card-soft: var(--card-soft, #e8efe6);
  --c-card-wash: var(--card-wash, #f3f7f1);
  --c-gold: var(--gold, #e8a33d);
  --c-gold-deep: var(--gold-deep, #b97a1e);
  --c-line: var(--line, rgba(21, 22, 26, 0.10));
  --c-line-2: var(--line-2, rgba(21, 22, 26, 0.20));
  --c-text: var(--text, #15161a);
  --c-text-2: var(--text-2, #3a4046);
  --c-muted: var(--muted, #5d6570);
  --c-mono: var(--font-mono, ui-monospace, Menlo, monospace);
  --c-display: var(--font-display, system-ui, sans-serif);
}

.pc-calc {
  margin: 8px 0 40px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-xl, 26px);
  background: #ffffff;
  box-shadow: var(--shadow-md, 0 8px 24px -6px rgba(21, 22, 26, 0.12));
  overflow: hidden;
}
.pc-calc[hidden] { display: none; }

.pc-calc-head { padding: 26px 20px 4px; }
@media (min-width: 720px) { .pc-calc-head { padding: 34px 34px 6px; } }
.pc-calc-kicker {
  font-family: var(--c-mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--c-card-deep);
}
.pc-calc-head h3 {
  font-family: var(--c-display);
  font-size: clamp(22px, 4.6vw, 30px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin: 8px 0 10px;
  color: var(--c-text);
}
.pc-calc-head p { font-size: 16px; line-height: 1.6; color: var(--c-text-2); max-width: 760px; margin: 0; }
.pc-calc-head strong { color: var(--c-text); }

.pc-calc-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
@media (min-width: 980px) { .pc-calc-grid { grid-template-columns: 1.35fr 1fr; } }

/* ---------- Armado de la operación ---------- */
.pc-calc-build { padding: 18px 20px 24px; min-width: 0; }
@media (min-width: 720px) { .pc-calc-build { padding: 22px 34px 32px; } }

.pc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  font-size: 13.5px;
  color: var(--c-muted);
}
.pc-legend li { display: inline-flex; align-items: center; gap: 7px; }
.pc-legend .pc-token { width: 24px; height: 24px; }

.pc-sites { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
@media (min-width: 640px) { .pc-sites { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.pc-site {
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg, 18px);
  background: var(--c-card-wash);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.pc-site-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pc-site-name {
  font-family: var(--c-display);
  font-weight: 800;
  font-size: 16px;
  color: var(--c-text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.pc-site-name svg { width: 18px; height: 18px; color: var(--c-card-deep); }
.pc-site-remove {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--c-muted);
  cursor: pointer;
}
.pc-site-remove:hover { background: #ffffff; border-color: var(--c-line); color: var(--c-text); }
.pc-site-remove svg { width: 16px; height: 16px; }

.pc-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 34px;
  align-content: flex-start;
}
.pc-tokens-empty { font-size: 13.5px; color: var(--c-muted); align-self: center; }
.pc-token {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #ffffff;
  border: 1.5px solid rgba(93, 122, 94, 0.45);
  color: var(--c-card-deep);
  flex: 0 0 auto;
}
.pc-token svg { width: 60%; height: 60%; }
.pc-token--more {
  font-family: var(--c-mono);
  font-size: 11.5px;
  font-weight: 700;
  width: auto;
  padding: 0 8px;
}
.pc-token.is-new { animation: pc-pop 340ms cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes pc-pop {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); }
}

.pc-stepper { display: flex; align-items: center; gap: 8px; }
.pc-stepper-label { font-size: 14px; color: var(--c-text-2); margin-right: auto; }
.pc-step {
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--c-line-2);
  background: #ffffff;
  color: var(--c-text);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 120ms ease;
}
.pc-step:hover { border-color: var(--c-card); background: var(--c-card-soft); }
.pc-step:active { transform: scale(0.94); }
.pc-step:disabled { opacity: 0.4; cursor: default; transform: none; background: #ffffff; border-color: var(--c-line-2); }
.pc-step svg { width: 18px; height: 18px; }
.pc-count {
  width: 64px; height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--c-line-2);
  background: #ffffff;
  text-align: center;
  font-family: var(--c-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--c-text);
  -moz-appearance: textfield;
  appearance: textfield;
}
.pc-count::-webkit-outer-spin-button,
.pc-count::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.pc-add {
  margin-top: 12px;
  width: 100%;
  min-height: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--r-md, 12px);
  border: 1.5px dashed rgba(93, 122, 94, 0.6);
  background: transparent;
  color: var(--c-card-deep);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}
.pc-add:hover { background: var(--c-card-wash); }
.pc-add:disabled { opacity: 0.5; cursor: default; }
.pc-add svg { width: 18px; height: 18px; }

/* Rotación: el personal cambia, el puesto no */
.pc-rotation {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-radius: var(--r-lg, 18px);
  background: #fffdf8;
  border: 1px dashed rgba(185, 122, 30, 0.45);
}
.pc-rotation p { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--c-text-2); }
.pc-rotation strong { color: var(--c-text); }
.pc-rot-visual { position: relative; flex: 0 0 auto; width: 92px; height: 64px; }
.pc-rot-visual .pc-token { position: absolute; left: 29px; top: 0; width: 34px; height: 34px; }
.pc-rot-people { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; }
.pc-person {
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--c-card-soft);
  color: var(--c-card-deep);
  opacity: 0.45;
  transition: opacity 300ms ease, transform 300ms ease, background 300ms ease;
}
.pc-person svg { width: 15px; height: 15px; }
.pc-person.is-on { opacity: 1; background: var(--c-gold); color: #3d2a06; transform: translateY(-3px); }

/* ---------- Resultado ---------- */
.pc-result {
  background:
    radial-gradient(520px 260px at 90% -10%, rgba(93, 122, 94, 0.38), transparent 62%),
    linear-gradient(170deg, var(--c-ink) 0%, #171b17 100%);
  color: var(--c-paper);
  padding: 24px 20px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
@media (min-width: 720px) { .pc-result { padding: 30px 30px 32px; } }
.pc-result-total {
  font-family: var(--c-mono);
  font-size: 12.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: rgba(240, 236, 223, 0.72);
}
.pc-result-total b {
  display: block;
  font-family: var(--c-display);
  font-size: 54px;
  line-height: 1;
  letter-spacing: -0.03em;
  text-transform: none;
  color: #ffffff;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.pc-meter { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 2px 0 4px; padding: 0; list-style: none; }
.pc-meter li { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pc-meter-bar { height: 8px; border-radius: 999px; background: rgba(240, 236, 223, 0.14); transition: background 220ms ease; }
.pc-meter-label {
  font-family: var(--c-mono);
  font-size: 10.5px;
  font-weight: 700;
  color: rgba(240, 236, 223, 0.55);
  text-align: center;
  white-space: nowrap;
}
.pc-meter li.is-past .pc-meter-bar { background: rgba(143, 181, 145, 0.45); }
.pc-meter li.is-on .pc-meter-bar { background: var(--c-card-bright); box-shadow: 0 0 14px rgba(143, 181, 145, 0.6); }
.pc-meter li.is-on .pc-meter-label { color: #ffffff; }
.pc-meter li.is-on.is-custom .pc-meter-bar { background: var(--c-gold); box-shadow: 0 0 14px rgba(232, 163, 61, 0.55); }

.pc-plan {
  border-top: 1px solid rgba(240, 236, 223, 0.14);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pc-plan-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pc-plan-name { font-family: var(--c-display); font-size: 26px; font-weight: 800; color: #ffffff; letter-spacing: -0.02em; }
.pc-plan-range {
  font-family: var(--c-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--c-card-bright);
  background: rgba(143, 181, 145, 0.14);
  border: 1px solid rgba(143, 181, 145, 0.3);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.pc-plan-price { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.pc-plan-amount { font-family: var(--c-display); font-size: 40px; font-weight: 800; color: #ffffff; line-height: 1.05; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.pc-plan-unit { font-family: var(--c-mono); font-size: 13.5px; font-weight: 700; color: var(--c-card-bright); }
.pc-plan-suffix { font-size: 13px; color: rgba(240, 236, 223, 0.72); }
.pc-plan-clp {
  align-self: flex-start;
  font-family: var(--c-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--c-paper);
  background: rgba(240, 236, 223, 0.10);
  padding: 4px 11px;
  border-radius: 999px;
}
.pc-plan-custom { font-size: 15px; line-height: 1.55; color: rgba(240, 236, 223, 0.85); margin: 0; }
.pc-plan-custom strong { color: #ffffff; }
.pc-plan-benefit { font-family: var(--c-mono); font-size: 12px; font-weight: 700; color: var(--c-gold); letter-spacing: 0.4px; }
.pc-plan-empty { font-size: 15px; color: rgba(240, 236, 223, 0.85); margin: 0; }

.pc-cta {
  margin-top: 6px;
  width: 100%;
  min-height: 52px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 20px;
  border-radius: var(--r-md, 12px);
  border: 1px solid transparent;
  background: linear-gradient(140deg, #6c8c6d 0%, var(--c-card) 45%, var(--c-card-deep) 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 12px 34px -8px rgba(93, 122, 94, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 140ms ease, filter 160ms ease;
}
.pc-cta:hover { transform: translateY(-2px); filter: brightness(1.08); }
.pc-cta svg { width: 19px; height: 19px; }
.pc-result-fine { font-size: 12.5px; line-height: 1.5; color: rgba(240, 236, 223, 0.6); margin: 0; }

/* Foco visible en todo lo interactivo */
.pc-calc button:focus-visible,
.pc-calc input:focus-visible,
.pc-demo button:focus-visible,
.pc-demo input:focus-visible,
.pc-demo select:focus-visible,
.pc-demo a:focus-visible {
  outline: 3px solid var(--gold, #e8a33d);
  outline-offset: 2px;
}

.pc-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ============================================================
   Formulario de demo (dialog nativo)
   ============================================================ */
.pc-demo {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: none;
  border-radius: var(--r-xl, 22px);
  background: #ffffff;
  color: var(--text, #15161a);
  box-shadow: 0 30px 80px -20px rgba(21, 22, 26, 0.45);
  overflow: auto;
}
.pc-demo::backdrop { background: rgba(10, 11, 14, 0.62); }
.pc-demo-inner { padding: 26px 22px 22px; position: relative; }
@media (min-width: 560px) { .pc-demo-inner { padding: 32px 32px 26px; } }
.pc-demo-close {
  position: absolute; top: 12px; right: 12px;
  width: 40px; height: 40px;
  border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--muted, #5d6570);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.pc-demo-close:hover { background: var(--bg-2, #f6f7f4); color: var(--text, #15161a); }
.pc-demo-close svg { width: 18px; height: 18px; }
.pc-demo h2 {
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 24px; font-weight: 800; letter-spacing: -0.02em;
  margin: 0 40px 6px 0; color: var(--text, #15161a);
}
.pc-demo-sub { font-size: 15px; color: var(--text-2, #3a4046); margin: 0 0 18px; line-height: 1.55; }
.pc-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.pc-field label { font-weight: 700; font-size: 14.5px; color: var(--text, #15161a); }
.pc-field .pc-opt { font-weight: 500; color: var(--muted, #5d6570); }
.pc-field input,
.pc-field select {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line-2, rgba(21, 22, 26, 0.2));
  background: #ffffff;
  color: var(--text, #15161a);
  font: inherit;
  font-size: 16px;
}
.pc-field select { appearance: auto; }
.pc-field input[aria-invalid="true"],
.pc-field select[aria-invalid="true"] { border-color: #c84a3a; background: #fff8f6; }
.pc-field-err { font-size: 13.5px; color: #a83a2c; margin: 0; }
.pc-field-err:empty { display: none; }
.pc-hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.pc-demo-status {
  margin: 4px 0 12px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14.5px;
  line-height: 1.5;
  background: #fff4f1;
  border: 1px solid rgba(200, 74, 58, 0.35);
  color: #7d2a1f;
}
.pc-demo-status:empty { display: none; }
.pc-demo-status a { color: inherit; text-decoration: underline; font-weight: 700; }
.pc-submit { width: 100%; }
.pc-submit[disabled] { opacity: 0.7; cursor: progress; transform: none; }
.pc-demo-privacy { margin: 12px 0 0; font-size: 13px; text-align: center; color: var(--muted, #5d6570); }
.pc-demo-privacy a { color: var(--muted, #5d6570); text-decoration: underline; }
.pc-demo-done { text-align: center; padding: 10px 0 4px; }
.pc-demo-done-icon {
  width: 56px; height: 56px; margin: 0 auto 14px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--card-soft, #e8efe6); color: var(--card-deep, #3f5540);
}
.pc-demo-done-icon svg { width: 28px; height: 28px; }
.pc-demo-done h2 { margin: 0 0 8px; }
.pc-demo-done p { font-size: 15.5px; color: var(--text-2, #3a4046); margin: 0 0 20px; line-height: 1.55; }
.pc-demo .pc-cta { margin-top: 4px; }

@media (prefers-reduced-motion: reduce) {
  .pc-token.is-new { animation: none; }
  .pc-person, .pc-step, .pc-cta, .pc-meter-bar { transition: none; }
  .pc-cta:hover { transform: none; }
}
