:root {
  --bg: #0e0e12;
  --bg-2: #16161d;
  --card: #1c1c25;
  --card-2: #252531;
  --line: #2e2e3c;
  --text: #f3f3f7;
  --muted: #a0a0b4;
  --brand: #8b5cf6;
  --brand-2: #f472b6;
  --on-brand: #ffffff;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 18px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --tabbar-h: 68px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-2); }
img, video { max-width: 100%; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
#app { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: calc(var(--safe-top) + 10px) calc(var(--safe-right) + 16px) 10px calc(var(--safe-left) + 16px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; flex: 1; min-width: 0; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: var(--muted); font-size: 12px; }
.avatar {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; font-weight: 700; color: var(--on-brand);
  background-size: cover; background-position: center; overflow: hidden;
}
.role-pill, .net-pill { font-size: 12px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.net-pill { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }

main {
  flex: 1; outline: none;
  padding: 16px calc(var(--safe-right) + 16px) calc(var(--tabbar-h) + var(--safe-bottom) + 24px) calc(var(--safe-left) + 16px);
  max-width: 640px; width: 100%; margin: 0 auto;
}
body.no-tabs main { padding-bottom: calc(var(--safe-bottom) + 24px); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  padding: 6px calc(var(--safe-right) + 6px) calc(var(--safe-bottom) + 6px) calc(var(--safe-left) + 6px);
  background: color-mix(in srgb, var(--bg-2) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: none; border: 0; color: var(--muted); font-size: 11px; border-radius: 14px; position: relative; cursor: pointer;
}
.tab svg { width: 26px; height: 26px; }
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"] svg { color: var(--brand); }
.tab .dot { position: absolute; top: 6px; right: calc(50% - 20px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--brand-2); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }

/* ---------- type ---------- */
h1 { font-size: 26px; line-height: 1.15; margin: 4px 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 19px; margin: 0 0 8px; }
h3 { font-size: 16px; margin: 0 0 6px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.lead { color: var(--muted); margin-bottom: 18px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 22px 0 10px; }
.section-title h2 { margin: 0; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card.tappable { cursor: pointer; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.kv { display: grid; gap: 10px; }
.kv > div > span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 2px; }
.list-steps { margin: 4px 0 0; padding-left: 20px; }
.list-steps li { margin-bottom: 4px; }
.empty { text-align: center; padding: 34px 18px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty .big { font-size: 40px; display: block; margin-bottom: 6px; }

/* ---------- chips / badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--card-2); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.badge.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.badge.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.badge.brand { color: var(--brand-2); background: color-mix(in srgb, var(--brand-2) 14%, transparent); }
.badge.plain::before { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 10px 16px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); cursor: pointer; font-size: 15px;
}
.chip[aria-pressed="true"] { background: color-mix(in srgb, var(--brand) 22%, var(--card)); border-color: var(--brand); }

.options { display: grid; gap: 10px; }
.option {
  display: block; width: 100%; text-align: left; padding: 14px 16px; min-height: 56px;
  border-radius: 16px; border: 1px solid var(--line); background: var(--card); cursor: pointer;
}
.option strong { display: block; }
.option small { color: var(--muted); }
.option[aria-pressed="true"] { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 16%, var(--card)); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 20px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--card-2); color: var(--text); font-weight: 600; font-size: 16px; cursor: pointer; text-decoration: none;
}
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.ok { background: color-mix(in srgb, var(--ok) 22%, var(--card)); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; }
.btn.sm { min-height: 40px; padding: 8px 14px; font-size: 14px; border-radius: 12px; }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btn-row > .btn { flex: 1 1 0; min-width: 0; }
.icon-btn { width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 12px; flex: none; }

/* ---------- forms ---------- */
label.field { display: block; margin-bottom: 16px; }
label.field > span { display: block; font-weight: 600; margin-bottom: 6px; }
label.field > small, .hint { display: block; color: var(--muted); font-size: 13px; margin-top: 6px; }
input[type=text], input[type=url], input[type=email], input[type=time], input[type=number], select, textarea {
  width: 100%; min-height: 52px; padding: 13px 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--bg-2); font-size: 16px; /* 16px evita el zoom en iPhone */
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .chip:focus-visible, .option:focus-visible, .tab:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}
.color-row { display: flex; gap: 12px; }
.color-row label { flex: 1; }
input[type=color] { width: 100%; height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-2); padding: 4px; }
.prefix-input { display: flex; align-items: center; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding-left: 14px; }
.prefix-input b { color: var(--muted); font-weight: 500; }
.prefix-input input { border: 0; background: transparent; padding-left: 4px; }
.prefix-input:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.prefix-input input:focus { outline: none; }

/* ---------- onboarding ---------- */
.wizard-top { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.progress { flex: 1; height: 8px; border-radius: 99px; background: var(--card-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: inherit; transition: width .3s; }
.block-tag { font-size: 13px; color: var(--brand-2); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.wizard-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9;
  display: flex; gap: 10px; padding: 12px calc(var(--safe-right) + 16px) calc(var(--safe-bottom) + 12px) calc(var(--safe-left) + 16px);
  background: linear-gradient(transparent, var(--bg) 30%);
}
.wizard-nav .btn { flex: 1; }
.wizard-body { padding-bottom: 90px; }
.logo-drop { display: flex; align-items: center; gap: 14px; }
.logo-drop .avatar { width: 72px; height: 72px; border-radius: 20px; font-size: 26px; }
.summary-lines { margin: 0; padding: 0; list-style: none; }
.summary-lines li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.summary-lines li:last-child { border-bottom: 0; }
.summary-lines b { color: var(--muted); font-weight: 600; }

/* ---------- uploads ---------- */
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.file-row:last-child { border-bottom: 0; }
.file-row .meta { flex: 1; min-width: 0; }
.file-row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.bar { height: 6px; border-radius: 99px; background: var(--card-2); overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--brand); transition: width .2s; }
.thumb { width: 52px; height: 52px; border-radius: 10px; background: var(--card-2); flex: none; display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.thumb video { width: 100%; height: 100%; object-fit: cover; }

/* ---------- review ---------- */
.player { width: 100%; aspect-ratio: 9 / 16; max-height: 70vh; background: #000; border-radius: var(--radius); object-fit: contain; display: block; margin: 0 auto 14px; }
.player-ph { aspect-ratio: 9/16; max-height: 52vh; margin: 0 auto 14px; border-radius: var(--radius); background: repeating-linear-gradient(45deg, var(--card), var(--card) 12px, var(--card-2) 12px, var(--card-2) 24px); display: grid; place-items: center; text-align: center; padding: 20px; color: var(--muted); }
.copy-field { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.copy-field header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.copy-field header span { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.copy-field p { margin: 0; white-space: pre-wrap; word-break: break-word; }

/* ---------- segmented ---------- */
.segmented { display: flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; margin-bottom: 14px; overflow-x: auto; }
.segmented button { flex: 1; min-height: 40px; border: 0; border-radius: 10px; background: none; color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; padding: 0 10px; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--card-2); color: var(--text); }

/* ---------- sheet & toast ---------- */
.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 640px; max-height: 88vh;
  background: var(--bg-2); color: var(--text); border-radius: 24px 24px 0 0;
}
.sheet::backdrop { background: rgba(0,0,0,.6); }
.sheet .sheet-inner { padding: 20px calc(var(--safe-right) + 18px) calc(var(--safe-bottom) + 20px) calc(var(--safe-left) + 18px); overflow-y: auto; max-height: 88vh; }
.sheet .grab { width: 44px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 14px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px); transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- misc ---------- */
.notice { border-radius: 14px; padding: 12px 14px; background: color-mix(in srgb, var(--brand) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent); font-size: 14px; margin-bottom: 14px; }
.notice.warn { background: color-mix(in srgb, var(--warn) 10%, var(--card)); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.worker { display: flex; gap: 14px; align-items: flex-start; }
.worker .ico { width: 46px; height: 46px; border-radius: 14px; background: var(--card-2); display: grid; place-items: center; font-size: 22px; flex: none; }
.steps-install { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps-install li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.steps-install li::before { content: counter(s); width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-weight: 700; flex: none; }
details.card summary { cursor: pointer; font-weight: 600; list-style: none; }
details.card summary::-webkit-details-marker { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- interruptor ---------- */
.switch-row { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; cursor: pointer; }
.switch-row > span { flex: 1; }
.switch-row small { display: block; color: var(--muted); font-size: 13px; }
.switch-row input { appearance: none; -webkit-appearance: none; width: 52px; height: 32px; border-radius: 99px; background: var(--card-2); border: 1px solid var(--line); position: relative; flex: none; cursor: pointer; transition: background .2s; }
.switch-row input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch-row input:checked { background: var(--brand); border-color: var(--brand); }
.switch-row input:checked::after { transform: translateX(20px); }
.switch-row input:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- antes de grabar ---------- */
.checklist { display: grid; gap: 8px; }
.check-item { display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.check-item strong { display: block; }
.check-item small { color: var(--muted); font-size: 13px; }
.check-item .tick { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; color: transparent; }
.check-item .tick svg { width: 16px; height: 16px; }
.check-item[aria-pressed="true"] { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.check-item[aria-pressed="true"] .tick { background: var(--ok); border-color: var(--ok); color: #0b2b1f; }
.check-item[aria-pressed="true"] strong { color: var(--muted); text-decoration: line-through; }

/* ---------- modo guion ---------- */
.prompter { position: fixed; inset: 0; z-index: 40; background: #000; display: flex; flex-direction: column; }
.prompter-text::before { content: ""; display: block; height: calc(var(--safe-top) + 28vh); }
.prompter-text::after { content: ""; display: block; height: 60vh; }
.prompter-text { flex: 1; min-height: 0; overflow-y: auto; padding: 0 calc(var(--safe-right) + 24px) 0 calc(var(--safe-left) + 24px); font-weight: 650; line-height: 1.35; color: #fff; cursor: pointer; -webkit-overflow-scrolling: touch; }
.prompter-text p { margin: 0 0 .7em; }
.prompter-guide { position: fixed; left: 0; right: 0; top: calc(var(--safe-top) + 28vh); height: 0; border-top: 2px dashed color-mix(in srgb, var(--brand) 70%, transparent); pointer-events: none; }
.prompter-bar .btn { white-space: nowrap; padding-left: 10px; padding-right: 10px; }
.prompter-bar { flex: none; display: flex; gap: 6px; align-items: center; padding: 10px calc(var(--safe-right) + 12px) calc(var(--safe-bottom) + 10px) calc(var(--safe-left) + 12px); background: #111117; border-top: 1px solid var(--line); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
