:root {
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --paper: #f8fafc;
  --card: #ffffff;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --danger: #9f1239;
  --danger-soft: #ffe4e6;
  --warn: #92400e;
  --warn-soft: #fef3c7;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: #e7e5e4;
  -webkit-text-size-adjust: 100%;
}

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

button, a { -webkit-tap-highlight-color: transparent; }

.shell {
  width: min(100%, 430px);
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 auto;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: #0f172a;
  color: white;
}

.topbar h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.topbar p { margin: 2px 0 0; color: #cbd5e1; font-size: 0.82rem; }

.topbar .grow { flex: 1; min-width: 0; }

.icon-btn, .text-btn {
  border: 0;
  background: transparent;
  color: white;
  min-height: 44px;
  padding: 0 4px;
}

.text-btn { font-size: 0.92rem; }

.screen {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px 16px 20px;
  -webkit-overflow-scrolling: touch;
}

.mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  margin-bottom: 18px;
}

.lead { margin: 0 0 18px; color: var(--muted); line-height: 1.45; }

.gate {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
  background: #0f172a;
}

.gate-brand {
  color: white;
  padding: calc(28px + env(safe-area-inset-top)) 24px 8px;
}

.gate-brand .mark { background: white; color: #0f172a; }

.eyebrow {
  margin: 14px 0 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #99f6e4;
}

.gate-brand h1 {
  margin: 4px 0 8px;
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.gate-brand p { margin: 0; color: #cbd5e1; line-height: 1.45; max-width: 28rem; }

.gate-brand ol {
  display: none;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.gate-brand li {
  position: relative;
  padding: 0 0 16px 22px;
  color: #e2e8f0;
}

.gate-brand li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2dd4bf;
}

.gate-panel {
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
}

.gate-card { width: min(100%, 400px); }

.gate-card h2 {
  margin: 0 0 6px;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}

.pass-wrap { position: relative; display: block; }

.pass-wrap input { padding-right: 88px; }

.pass-toggle {
  position: absolute;
  top: 6px;
  right: 6px;
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  padding: 0 10px;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

@media (min-width: 860px) {
  .gate {
    grid-template-columns: minmax(340px, 1.1fr) minmax(420px, 0.9fr);
    grid-template-rows: 1fr;
  }
  .gate-brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 64px 72px;
  }
  .gate-brand h1 { font-size: 3rem; }
  .gate-brand ol { display: block; }
  .gate-panel { border-radius: 0; padding: 48px; }
}

label { display: block; margin-bottom: 14px; }

.label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.82rem;
  font-weight: 650;
  color: #334155;
}

input, select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: white;
  font-size: 16px;
}

textarea { min-height: 110px; resize: vertical; line-height: 1.4; }

.primary, .secondary, .quiet {
  min-height: 48px;
  border-radius: 12px;
  border: 0;
  padding: 12px 16px;
  font-weight: 650;
}

.primary { width: 100%; background: var(--accent); color: white; }

.primary:active { background: #115e59; }

button:disabled { opacity: 0.4; cursor: default; }

.secondary {
  width: 100%;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}

.quiet {
  background: transparent;
  color: var(--danger);
  width: auto;
  padding-left: 0;
}

.error, .saved {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  line-height: 1.4;
}

.error { background: var(--danger-soft); color: var(--danger); }

.saved { background: var(--accent-soft); color: #115e59; }

.segments {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  background: #e2e8f0;
  border-radius: 14px;
  margin: 14px 0;
}

.segments button {
  border: 0;
  background: transparent;
  border-radius: 11px;
  min-height: 52px;
  padding: 6px 4px;
  color: #334155;
}

.segments button strong { display: block; font-size: 1rem; }

.segments button span { display: block; font-size: 0.72rem; color: var(--muted); }

.segments button.active { background: white; box-shadow: var(--shadow); }

.segments button.active span { color: var(--accent); }

.list { display: grid; gap: 10px; }

.card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.person {
  width: 100%;
  text-align: left;
  padding: 14px;
  border: 1px solid var(--line);
}

.person .name { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em; }

.person .sub, .sub { color: var(--muted); font-size: 0.88rem; margin-top: 3px; }

.next-line {
  margin-top: 8px;
  font-size: 0.92rem;
  line-height: 1.35;
}

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #e2e8f0;
}

.pill.antes { background: var(--warn-soft); color: var(--warn); }
.pill.tramite { background: #dbeafe; color: #1e3a8a; }
.pill.cierre { background: var(--accent-soft); color: #115e59; }
.pill.no { background: var(--danger-soft); color: var(--danger); }

.empty { text-align: center; color: var(--muted); padding: 28px 12px; line-height: 1.45; }

.path {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  list-style: none;
  margin: 0 0 14px;
  padding: 2px 0 8px;
}

.path li {
  flex: 1;
  min-width: 68px;
  text-align: center;
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 650;
}

.path li::before {
  content: "";
  display: block;
  width: 12px;
  height: 12px;
  margin: 0 auto 6px;
  border-radius: 50%;
  background: #cbd5e1;
}

.path li.done { color: var(--accent); }
.path li.done::before { background: var(--accent); }
.path li.now { color: var(--ink); }
.path li.now::before { background: var(--ink); box-shadow: 0 0 0 4px #e2e8f0; }

.callout {
  padding: 14px;
  margin-bottom: 12px;
}

.callout .kicker {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.callout h2 { margin: 0 0 6px; font-size: 1.25rem; letter-spacing: -0.03em; }

.callout p { margin: 0; line-height: 1.45; }

.choices { display: grid; gap: 8px; }

.choice {
  width: 100%;
  text-align: left;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: 48px;
  padding: 12px 14px;
}

.choice.active { border-color: var(--accent); background: #f0fdfa; }

.choice small { display: block; color: var(--muted); margin-top: 2px; }

.group-title {
  margin: 16px 0 8px;
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.tabs {
  position: relative;
  z-index: 4;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: white;
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabs button {
  border: 0;
  background: white;
  min-height: 56px;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--muted);
}

.tabs button.active { color: var(--accent); }

.note, .file {
  padding: 12px 14px;
  margin-bottom: 8px;
}

.note p { margin: 6px 0; white-space: pre-wrap; line-height: 1.4; }

.file-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.check {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.check strong { display: block; }

.check span { color: var(--muted); font-size: 0.82rem; }

.ok { color: var(--accent); font-weight: 700; font-size: 0.82rem; }
.miss { color: var(--warn); font-weight: 700; font-size: 0.82rem; }

.stack { display: grid; gap: 0; }

.flow {
  display: flex;
  gap: 8px;
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}

.flow li {
  position: relative;
  flex: 1;
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.flow li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 12px;
  left: 30px;
  right: 4px;
  height: 2px;
  background: #e2e8f0;
}

.flow li.done:not(:last-child)::after { background: #99f6e4; }

.flow li span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-bottom: 6px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.78rem;
}

.flow li.now { color: var(--ink); }
.flow li.now span,
.flow li.done span { background: var(--accent); color: white; }

.row-actions {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 8px;
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 18px -16px 0;
  padding: 12px 16px 8px;
  background: linear-gradient(to top, var(--paper) 72%, rgba(248, 250, 252, 0));
}

.actions { display: grid; gap: 8px; }

.action {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: 64px;
  padding: 12px 14px;
}

.action b {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: #115e59;
}

.action small { display: block; color: var(--muted); font-weight: 500; margin-top: 2px; }

.guide {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.4;
}

.file-pick {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  margin-bottom: 8px;
  border: 1px dashed #94a3b8;
  border-radius: 12px;
  background: white;
  font-weight: 650;
  color: var(--accent);
}

.file-pick input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 480px) {
  body { background: var(--paper); }
  .shell { box-shadow: none; width: 100%; }
}
