/*
 * First-install /setup (layouts/setup_wizard). The PerfectFlow door, like the
 * login and the setup assistant: brand gradient + faint P+F pattern, Chillax
 * headings, Inter body, a white card with the ink border and hard shadow of
 * the landing, lime CTA. Standalone on purpose — no Bootstrap, no Tailwind.
 */
@font-face {
  font-family: "Chillax";
  src: url(/assets/chillax-variable-4ae39a7bb4766820c0216e746fafc943e345b94176cdce0b1ec4b31a423d0f15.woff2) format("woff2");
  font-weight: 200 700; font-style: normal; font-display: swap;
}

.sw {
  --pf-magenta: #D600FE; --pf-violet: #7A0FFE; --pf-blue: #011EFE; --pf-lime: #D9FF57; --pf-ink: #15131B;
  --pf-grad: linear-gradient(125deg, #D600FE 0%, #7A0FFE 48%, #011EFE 100%);
  --ink-70: #45414F; --muted: #625F78; --line-soft: #E7E5EF; --surface: #FAF9FD; --coral: #FF6A47;
  --violet-tx: #5B12C9;
  --line: 2px solid var(--pf-ink);
  --hard: 6px 6px 0 var(--pf-ink); --hard-sm: 4px 4px 0 var(--pf-ink); --hard-lg: 10px 10px 0 var(--pf-ink);
  --ease: cubic-bezier(.22, .9, .24, 1);
  --display: "Chillax", Inter, ui-sans-serif, system-ui, sans-serif;
  --body: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;

  position: relative; margin: 0; min-height: 100vh; min-height: 100dvh; overflow-x: hidden;
  background: var(--pf-violet); color: #fff;
  font: 16px/1.55 var(--body); -webkit-font-smoothing: antialiased;
}
.sw *, .sw *::before, .sw *::after { box-sizing: border-box; }
.sw [hidden] { display: none !important; }
.sw ::selection { background: var(--pf-lime); color: var(--pf-ink); }
.sw :focus-visible { outline: 3px solid var(--pf-ink); outline-offset: 3px; }
.sw-i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Gradient + pattern behind everything (absolute: grows with tall phone pages). */
.sw-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: var(--pf-grad); }
.sw-pattern {
  position: absolute; inset: -10%; opacity: .09;
  background-image: url(/assets/login_pattern-7cc5302c283c923e0e598d164ed3cbc8191206bd2eef32f8d891eb451e6b1b49.svg); background-size: 150px 150px;
  animation: sw-pan 60s linear infinite;
}
@keyframes sw-pan { to { background-position: 300px -150px; } }

.sw-shell {
  position: relative; z-index: 1; width: 100%; max-width: 1180px; min-height: 100vh; min-height: 100dvh; margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  display: grid; gap: 28px; align-content: center;
  grid-template-columns: minmax(0, 1fr); grid-template-areas: "brand" "main" "foot";
}

/* ── Brand panel ─────────────────────────────────────────────── */
.sw-brand { grid-area: brand; min-width: 0; }
.sw-mark { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px 8px 10px; background: #fff; color: var(--pf-ink);
  border: var(--line); border-radius: 999px; box-shadow: var(--hard-sm); }
.sw-iso { width: 22px; height: 28px; display: block; }
.sw-mark span { font: 600 18px/1 var(--display); letter-spacing: -.01em; }
.sw-badge {
  display: table; margin-top: 26px; background: var(--pf-lime); color: var(--pf-ink); border: var(--line); border-radius: 999px;
  box-shadow: var(--hard-sm); padding: .35em 1em; font-weight: 600; font-size: .88rem; line-height: 1.4; transform: rotate(-3deg);
}
.sw-title {
  margin: 18px 0 0; font: 700 clamp(2.4rem, 10vw, 4.6rem)/.98 var(--display); letter-spacing: -.025em; color: #fff; text-wrap: balance;
}
.sw-title-for { display: block; margin-top: .12em; font-size: .62em; line-height: 1.05; color: var(--pf-lime); overflow-wrap: anywhere; }
.sw-lead { margin: 18px 0 0; max-width: 34ch; font-size: clamp(1.05rem, 1.6vw, 1.3rem); line-height: 1.5; color: rgba(255, 255, 255, .94); }

.sw-next { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 10px; max-width: 420px; }
.sw-next li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 16px;
  background: rgba(255, 255, 255, .1); border: 1.5px solid rgba(255, 255, 255, .28); }
.sw-next li.is-now { background: rgba(255, 255, 255, .18); border-color: var(--pf-lime); }
.sw-next .n { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255, 255, 255, .2); font-weight: 700; font-size: .9rem; }
.sw-next li.is-now .n { background: var(--pf-lime); color: var(--pf-ink); }
.sw-next b { display: block; font-weight: 600; font-size: .98rem; line-height: 1.3; }
.sw-next small { display: block; font-size: .86rem; line-height: 1.4; color: rgba(255, 255, 255, .8); }

/* ── Card ────────────────────────────────────────────────────── */
.sw-main { grid-area: main; width: 100%; max-width: 520px; min-width: 0; }
.sw-card { background: #fff; color: var(--pf-ink); border: var(--line); border-radius: 24px; box-shadow: var(--hard-lg);
  padding: 26px 20px 22px; margin-right: 10px; }
.sw-heading { margin: 0 0 4px; font: 700 1.7rem/1.1 var(--display); letter-spacing: -.02em; color: var(--pf-ink); }
.sw-sub { margin: 0 0 20px; color: var(--ink-70); font-size: .95rem; line-height: 1.5; }
.sw-alert { margin: 0 0 18px; padding: 12px 14px; background: #FFE9E3; border: var(--line); border-radius: 14px;
  box-shadow: var(--hard-sm); font-weight: 500; font-size: .92rem; line-height: 1.45; }

.sw-form { display: grid; gap: 16px; }
.sw-row { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.sw-field { min-width: 0; }
.sw-label { display: block; margin: 0 0 6px; font-weight: 600; font-size: .9rem; color: var(--pf-ink); }
.sw-label small { font-weight: 500; color: var(--muted); }
.sw-input {
  display: block; width: 100%; min-height: 50px; padding: 12px 15px; font: inherit; font-size: 1rem; color: var(--pf-ink);
  background: #fff; border: var(--line); border-radius: 14px; outline: none; -webkit-appearance: none; appearance: none;
  transition: box-shadow .15s var(--ease), transform .15s var(--ease);
}
.sw-input::placeholder { color: #9A96AC; }
.sw-input:focus { box-shadow: var(--hard-sm); transform: translate(-2px, -2px); }
.sw .sw-input:focus-visible { outline: none; }
.sw-select {
  padding-right: 42px; background-repeat: no-repeat; background-position: right 14px center; background-size: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2315131B' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
.sw-note { margin: 0; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1.5px solid var(--line-soft);
  color: var(--ink-70); font-size: .95rem; line-height: 1.5; }
.sw-hint { margin: 6px 0 0; font-size: .84rem; line-height: 1.4; color: var(--muted); }

.sw-pass { position: relative; }
.sw-pass .sw-input { padding-right: 84px; }
.sw-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); min-height: 34px; padding: 0 12px;
  border: 0; border-radius: 10px; background: var(--surface); color: var(--violet-tx); font: 600 .84rem var(--body); cursor: pointer; }
.sw-eye:hover { background: #F1E9FF; }

/* Buttons */
.sw-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 54px; margin-top: 4px;
  padding: .75em 1.5em; background: var(--pf-lime); color: var(--pf-ink); border: var(--line); border-radius: 999px;
  box-shadow: var(--hard-sm); font: 600 1.02rem/1.2 var(--body); letter-spacing: -.01em; text-decoration: none; cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.sw-btn:hover { transform: translate(-2px, -2px); box-shadow: var(--hard); }
.sw-btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--pf-ink); }
.sw-btn:disabled { cursor: progress; }
.sw-btn.is-busy { opacity: .75; }
.sw-btn--ghost { background: #fff; box-shadow: none; }
.sw-btn--ghost:hover { box-shadow: var(--hard-sm); }
.sw-btn--add { min-height: 46px; margin-top: 0; border-style: dashed; font-size: .95rem; }
.sw-actions { display: flex; flex-wrap: wrap-reverse; gap: 12px; margin-top: 6px; }
.sw-actions .sw-btn { flex: 1 1 160px; margin-top: 0; }
.sw-link { padding: 0; border: 0; background: none; color: var(--violet-tx); font: 600 .88rem var(--body); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.sw-calm { display: flex; gap: 8px; align-items: flex-start; margin: 2px 0 0; font-size: .86rem; line-height: 1.45; color: var(--muted); }
.sw-calm .sw-i { width: 18px; height: 18px; color: #16A34A; margin-top: 1px; }

/* Logo drop zone */
.sw-drop {
  position: relative; display: flex; align-items: center; gap: 14px; min-height: 92px; padding: 14px 16px; cursor: pointer;
  border: 2px dashed #B9B4CC; border-radius: 16px; background: var(--surface); transition: border-color .15s, background .15s;
}
.sw-drop:hover, .sw-drop.is-over { border-color: var(--pf-violet); background: #F6F0FF; }
.sw-drop:focus-within { outline: 3px solid var(--pf-ink); outline-offset: 3px; }
.sw-drop.is-error { border-color: var(--coral); background: #FFF1EC; }
.sw-drop-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.sw-drop-ph { flex: none; display: grid; place-items: center; width: 60px; height: 60px; border-radius: 14px;
  background: #fff; border: 1.5px solid var(--line-soft); color: var(--pf-violet); }
.sw-drop-preview { display: none; flex: none; width: 60px; height: 60px; object-fit: contain; border-radius: 14px;
  background: #fff; border: 1.5px solid var(--line-soft); padding: 6px; }
.sw-drop.has-file .sw-drop-ph { display: none; }
.sw-drop.has-file .sw-drop-preview { display: block; }
.sw-drop-text { min-width: 0; display: grid; gap: 2px; }
.sw-drop-text b { font-weight: 600; font-size: .95rem; line-height: 1.35; overflow-wrap: anywhere; }
.sw-drop-text span { font-size: .84rem; color: var(--muted); }
.sw-drop + .sw-link { margin-top: 8px; }

/* Stepper (classic flow) */
.sw-steps { list-style: none; display: flex; gap: 6px; margin: 0 0 20px; padding: 0; }
.sw-steps li { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px;
  background: var(--surface); color: var(--muted); font-size: .84rem; font-weight: 600; }
.sw-steps .n { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; border: 1.5px solid var(--line-soft); font-size: .8rem; }
.sw-steps .n .sw-i { width: 14px; height: 14px; stroke-width: 3; }
.sw-steps .l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-steps .is-now { background: var(--pf-lime); color: var(--pf-ink); border: var(--line); }
.sw-steps .is-now .n { border-color: var(--pf-ink); }
.sw-steps .is-done { color: var(--pf-ink); }
.sw-steps .is-done .n { background: var(--pf-ink); color: var(--pf-lime); border-color: var(--pf-ink); }

/* Team rows (classic step 3) */
#users-container { display: grid; gap: 12px; }
.sw-user { padding: 14px; border-radius: 16px; background: var(--surface); border: 1.5px solid var(--line-soft); }
.sw-user-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.sw-user-title { font-weight: 600; font-size: .92rem; }
.sw-user-grid { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.sw-user .sw-input { min-height: 44px; padding: 9px 13px; border-width: 1.5px; border-radius: 12px; font-size: .95rem; }
.sw-user .sw-select { padding-right: 38px; }

/* Footer */
.sw-foot { grid-area: foot; display: flex; flex-wrap: wrap; gap: 6px; font-size: .86rem; color: rgba(255, 255, 255, .85); }
.sw-foot a { color: #fff; font-weight: 600; text-underline-offset: 3px; }

/* On a phone the form comes first: «Cómo sigue» only from tablet up. */
@media (max-width: 559px) {
  .sw-next { display: none; }
  /* Stepper: numbers only, the current step with its name. */
  .sw-steps li:not(.is-now) { flex: none; }
  .sw-steps li:not(.is-now) .l { display: none; }
}
@media (min-width: 560px) {
  .sw-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sw-user-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sw-card { padding: 32px 30px 26px; }
}
@media (min-width: 1024px) {
  .sw-shell {
    padding: 56px 40px 32px; gap: 36px 72px; align-items: center;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); grid-template-areas: "brand main" "foot foot";
  }
  .sw-main { justify-self: end; }
  .sw-card { padding: 38px 36px 30px; }
  .sw-heading { font-size: 2rem; }
}

@keyframes sw-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.sw-rise { animation: sw-rise .55s var(--ease) both; }
.sw-rise-2 { animation-delay: .08s; }
@media (prefers-reduced-motion: reduce) {
  .sw-rise, .sw-pattern { animation: none; }
  .sw-btn, .sw-input { transition: none; }
}

/* ── Dark (follows the device; ThemeHelper sets data-theme on <html>) ──────
   No big purple fill: the CRM's dark background, the pattern barely there,
   the brand only as a soft glow in two corners (like the login and the
   dashboard hero in dark). The card and its pieces become dark surfaces;
   the white PerfectFlow mark, the lime badge and CTA stay as they are. */
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="dark"] .sw {
  --ink-70: #B9B4CF; --muted: #A09BB8; --line-soft: #2E2B40; --surface: #1D1B2A; --violet-tx: #C4B5FD;
  --card: #18162A; --text: #F1EFF8; --field: #100F18; --field-line: #6A6586;
  background: #100F18;
}
:root[data-theme="dark"] .sw-bg {
  background: radial-gradient(60% 55% at 0% 0%, rgba(122, 15, 254, .30), transparent 70%),
              radial-gradient(50% 50% at 100% 100%, rgba(1, 30, 254, .18), transparent 70%), #100F18;
}
:root[data-theme="dark"] .sw-pattern { opacity: .018; }
:root[data-theme="dark"] .sw-card { box-shadow: 0 24px 60px -24px rgb(0 0 0 / .8), 0 0 0 1px #2E2B40; }
:root[data-theme="dark"] .sw-card { background: var(--card); color: var(--text); }
:root[data-theme="dark"] .sw-card :is(.sw-heading, .sw-label, .sw-user-title, .sw-drop-text b) { color: var(--text); }
:root[data-theme="dark"] .sw-card :focus-visible,
:root[data-theme="dark"] .sw-drop:focus-within { outline-color: var(--pf-lime); }
:root[data-theme="dark"] .sw-input { background-color: var(--field); color: var(--text); border-color: var(--field-line); }
:root[data-theme="dark"] .sw-input::placeholder { color: #8E89A8; }
:root[data-theme="dark"] .sw-input:focus { border-color: var(--pf-lime); box-shadow: 4px 4px 0 #000; }
:root[data-theme="dark"] .sw-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F1EFF8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] .sw-alert { background: #3A1616; color: #FFC9C9; border-color: #5E2424; }
:root[data-theme="dark"] .sw-eye:hover { background: #2F2552; }
:root[data-theme="dark"] .sw-btn--ghost { background: transparent; color: var(--text); border-color: var(--field-line); }
:root[data-theme="dark"] .sw-calm .sw-i { color: #6EE7A8; }
:root[data-theme="dark"] .sw-drop { border-color: var(--field-line); }
:root[data-theme="dark"] .sw-drop:hover, :root[data-theme="dark"] .sw-drop.is-over { background: #2A2245; border-color: #A78BFA; }
:root[data-theme="dark"] .sw-drop.is-error { background: #3A1A14; }
:root[data-theme="dark"] .sw-drop-ph { background: var(--card); color: #C4B5FD; }
/* The logo preview keeps a light plate: client logos are drawn for white. */
:root[data-theme="dark"] .sw-drop-preview { background: #F1EFF8; border-color: transparent; }
:root[data-theme="dark"] .sw-steps .n { background: var(--card); border-color: var(--line-soft); }
:root[data-theme="dark"] .sw-steps .is-now .n { background: #fff; border-color: var(--pf-ink); }
:root[data-theme="dark"] .sw-steps .is-done { color: var(--text); }
:root[data-theme="dark"] .sw-steps .is-done .n { background: var(--pf-lime); color: var(--pf-ink); border-color: var(--pf-lime); }
