/* FORMUL-A Tareas — paleta y tipografía tomadas de formulahairscience.com */
@font-face {
  font-family: "League Spartan";
  src: url("/fonts/league-spartan.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ink: #000000;
  --ink-2: #3a3a3a;
  --muted: #6f7a7e;
  --line: #e4e6ea;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --mist: #ececee;
  --sky: #b0cbe7;      /* acento de la marca */
  --sky-soft: #e7eff8;
  --aqua: #85cee4;     /* celeste del logotipo */
  --teal: #4e7c88;
  --deep: #002f3b;
  --danger: #c0392b;
  --radius: 22px;
  --shadow: 0 1px 2px rgba(0, 47, 59, .05), 0 8px 24px rgba(0, 47, 59, .06);
  --display: "League Spartan", "Avenir Next", "Helvetica Neue", sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 var(--body);
  min-height: 100dvh; overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; padding: calc(var(--safe-t) + 14px) 18px calc(var(--safe-b) + 110px); }

/* ---------- Logotipo ---------- */
.logo { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); }
.logo svg.mol { width: 22px; height: 32px; flex: none; }
.logo .word { font-family: var(--display); font-weight: 300; letter-spacing: .16em; font-size: 22px; line-height: 1; padding-top: 3px; display: inline-flex; align-items: center; }
.logo .word svg { width: .62em; height: .62em; margin: 0 .1em 0 0; transform: translateY(-.08em); }
.logo.big svg.mol { width: 34px; height: 50px; }
.logo.big .word { font-size: 36px; }

/* ---------- Cabecera ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin-bottom: 22px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; }
.icon-btn svg { width: 20px; height: 20px; }
.me-btn { border-radius: 50%; }

.hero h1 { font-family: var(--display); font-weight: 600; font-size: 34px; line-height: 1.02; letter-spacing: -.01em; }
.hero p { color: var(--muted); margin-top: 6px; }
.hero { margin-bottom: 22px; }

/* ---------- Avatares ---------- */
.avatar {
  --s: 72px; width: var(--s); height: var(--s); border-radius: 50%; flex: none;
  background: var(--sky); color: var(--deep);
  display: grid; place-items: center; overflow: hidden;
  font-family: var(--display); font-weight: 600; font-size: calc(var(--s) * .44); line-height: 1; padding-top: calc(var(--s) * .05);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; margin-top: calc(var(--s) * -.05); }
.avatar.has-img { padding-top: 0; }
.avatar.has-img img { margin-top: 0; }
.avatar.sm { --s: 40px; }
.avatar.md { --s: 52px; }
.avatar.xl { --s: 104px; }

/* ---------- Inicio: recuadros de personas ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.person {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 12px 16px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px;
  transition: transform .12s ease; width: 100%;
}
.person:active { transform: scale(.97); }
.person .name { font-weight: 600; font-size: 15px; line-height: 1.25; min-height: 2.5em; display: flex; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; background: var(--ink); color: #fff; }
.pill.zero { background: var(--mist); color: var(--muted); }
.pill.sky { background: var(--sky-soft); color: var(--deep); }
.person.is-me { outline: 2px solid var(--sky); outline-offset: -2px; }

/* ---------- Aviso de notificaciones ---------- */
.banner { background: var(--deep); color: #fff; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; display: flex; gap: 14px; align-items: center; }
.banner p { font-size: 14px; flex: 1; line-height: 1.35; }
.banner b { display: block; font-size: 15px; }
.banner button { background: var(--aqua); color: var(--deep); font-weight: 700; border-radius: 999px; padding: 10px 16px; font-size: 14px; flex: none; }

/* ---------- Pantalla de persona ---------- */
.person-head { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.person-head h1 { font-family: var(--display); font-weight: 600; font-size: 28px; line-height: 1.05; }
.person-head p { color: var(--muted); margin-top: 4px; }

.block-title { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--teal); margin: 22px 4px 10px; display: flex; align-items: center; gap: 8px; }
.block-title:first-of-type { margin-top: 0; }
.block-title span { background: var(--sky-soft); color: var(--deep); border-radius: 999px; padding: 2px 8px; letter-spacing: 0; font-size: 12px; }

.task { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 16px 14px 14px; display: flex; gap: 14px; margin-bottom: 12px; transition: opacity .25s, transform .25s; }
.task.done { opacity: .45; }
.task.done h3 { text-decoration: line-through; }
.task.gone { opacity: 0; transform: translateX(24px); }
.check { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--ink); flex: none; display: grid; place-items: center; margin-top: 1px; transition: background .15s; position: relative; }
.check::after { content: ""; position: absolute; inset: -9px; }
.check svg { width: 16px; height: 16px; opacity: 0; }
.task.done .check { background: var(--ink); }
.task.done .check svg { opacity: 1; }
.check[disabled] { border-color: var(--line); cursor: default; }
.task .body { flex: 1; min-width: 0; }
.task h3 { font-size: 16px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.task .notes { color: var(--ink-2); font-size: 14px; margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.task .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.chip { border-radius: 999px; padding: 3px 9px; background: var(--sky-soft); color: var(--deep); font-weight: 600; }
.chip.late { background: #fbe9e7; color: var(--danger); }
.link { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; font-size: 12.5px; margin-left: auto; padding: 4px 0; }
.link.danger { color: var(--danger); font-weight: 600; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ring { width: 72px; height: 72px; border-radius: 50%; background: var(--sky-soft); display: grid; place-items: center; margin: 0 auto 16px; color: var(--deep); }
.empty .ring svg { width: 30px; height: 30px; }
.empty b { display: block; color: var(--ink); font-family: var(--display); font-size: 22px; font-weight: 600; margin-bottom: 4px; }

/* ---------- Botones ---------- */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 600; font-size: 16px; padding: 0 22px; transition: transform .1s, opacity .2s; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; }
.btn.ghost { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn.soft { background: var(--sky-soft); color: var(--deep); }
.btn.small { min-height: 40px; font-size: 14px; width: auto; padding: 0 16px; }
.btn.danger { background: none; color: var(--danger); box-shadow: none; }

.fab { position: fixed; z-index: 5; right: max(18px, calc((100vw - 560px) / 2 + 18px)); bottom: calc(var(--safe-b) + 22px); height: 58px; border-radius: 999px; background: var(--ink); color: #fff; padding: 0 22px 0 18px; display: flex; align-items: center; gap: 8px; font-weight: 600; box-shadow: 0 10px 28px rgba(0, 0, 0, .28); }
.fab svg { width: 20px; height: 20px; }

/* ---------- Formularios ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span, .label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 0 4px 6px; }
.input { width: 100%; min-height: 52px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); padding: 13px 16px; font-size: 16px; outline: none; -webkit-appearance: none; appearance: none; }
textarea.input { min-height: 84px; resize: none; }
.input:focus { border-color: var(--ink); }
.input::placeholder { color: #a5adb1; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.error { color: var(--danger); font-size: 14px; margin: 4px 4px 12px; min-height: 1.3em; }

/* ---------- Login ---------- */
.login { min-height: calc(100dvh - var(--safe-t) - var(--safe-b) - 124px); display: flex; flex-direction: column; justify-content: center; }
.login .logo { justify-content: center; margin-bottom: 10px; }
.login .tag { text-align: center; color: var(--muted); margin-bottom: 36px; letter-spacing: .02em; }
.login-card { background: var(--surface); border-radius: 28px; box-shadow: var(--shadow); padding: 24px 20px 20px; }

/* ---------- Hoja inferior ---------- */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(0, 20, 26, .42); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; border-radius: 28px 28px 0 0; padding: 10px 18px calc(var(--safe-b) + 20px); animation: rise .24s cubic-bezier(.2, .8, .2, 1); }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: #cfd4d8; margin: 0 auto 14px; }
.sheet h2 { font-family: var(--display); font-weight: 600; font-size: 26px; margin-bottom: 16px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; }
.close { width: 36px; height: 36px; border-radius: 50%; background: var(--mist); display: grid; place-items: center; }
.close svg { width: 14px; height: 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: .6; } }

.who { display: flex; gap: 10px; overflow-x: auto; padding: 6px 18px 6px; margin: 0 -18px 12px; scrollbar-width: none; }
.who::-webkit-scrollbar { display: none; }
.who button { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 68px; flex: none; font-size: 12.5px; color: var(--muted); }
.who button span { max-width: 68px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 2px var(--bg); opacity: .55; transition: opacity .15s; }
.who button[aria-pressed="true"] { color: var(--ink); font-weight: 600; }
.who button[aria-pressed="true"] .avatar { opacity: 1; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }

/* ---------- Perfil / equipo ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; }
.card h2 { font-family: var(--display); font-weight: 600; font-size: 20px; margin-bottom: 4px; }
.card > p { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.profile-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; margin-bottom: 22px; }
.profile-head h1 { font-family: var(--display); font-weight: 600; font-size: 28px; line-height: 1.05; }
.profile-head p { color: var(--muted); margin-top: -6px; }
.profile-head .actions { display: flex; gap: 8px; }
.steps { margin: 0 0 14px; padding-left: 20px; color: var(--ink-2); font-size: 14px; }
.steps li { margin-bottom: 4px; }
.status { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #c5cbd0; }
.dot.on { background: #2e9e6b; }
.stack { display: grid; gap: 10px; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); width: 100%; text-align: left; }
.user-row:first-of-type { border-top: 0; }
.user-row .t { flex: 1; min-width: 0; }
.user-row .t b { display: block; font-size: 15px; }
.user-row .t small { color: var(--muted); }
.user-row.off { opacity: .5; }
.user-row > svg { width: 14px; height: 14px; color: var(--muted); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--mist); border-radius: 14px; padding: 4px; margin-bottom: 14px; }
.seg button { min-height: 40px; border-radius: 11px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* ---------- Toast ---------- */
#toast { position: fixed; z-index: 40; left: 50%; bottom: calc(var(--safe-b) + 96px); transform: translate(-50%, 20px); background: var(--deep); color: #fff; border-radius: 999px; padding: 12px 18px; font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; display: flex; gap: 14px; align-items: center; max-width: calc(100vw - 36px); white-space: nowrap; }
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast button { color: var(--aqua); font-weight: 700; }

.skeleton { height: 150px; border-radius: var(--radius); background: linear-gradient(100deg, #eceef1 40%, #f6f7f9 50%, #eceef1 60%) 0 0 / 200% 100%; animation: shine 1.2s linear infinite; }
@keyframes shine { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.card.user-row { padding: 16px 18px; border-top: 0; }
