:root {
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
html {
  scroll-padding-top: env(safe-area-inset-top, 0px);
}
body {
  margin: 0;
  padding: 0;
  font:
    14px -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background: #fff;
  color: #000;
}
img {
  max-width: 100%;
}
[hidden]:not([hidden="until-found" i]) {
  display: none !important;
}

/* Layout: ficha de taller en una columna; barra de progreso fija abajo; bloques plegables numerados como el PDF */
:root {
  --bg: #f7f2f1;
  --surface: #ffffff;
  --surface-2: #fbeeee;
  --line: #ecd3d1;
  --fg: #2a1d1c;
  --muted: #7a6564;
  --brand: #8b0000;
  --accent: #c0392b;
  --coral: #e8594a;
  --ok: #1f7a4d;
  --ok-bg: #e3f3ea;
  --ko: #c0392b;
  --ko-bg: #fbe3e0;
  --na: #6d6262;
  --na-bg: #eee9e8;
  --on-brand: #ffffff;
  --display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1312;
    --surface: #241a19;
    --surface-2: #2e2120;
    --line: #432f2d;
    --fg: #f2e6e4;
    --muted: #b39d9a;
    --brand: #7a0d0d;
    --accent: #e0574a;
    --coral: #ef6b5c;
    --ok: #5fcf94;
    --ok-bg: #16331f;
    --ko: #ff7a6b;
    --ko-bg: #3d1a17;
    --na: #c2b6b4;
    --na-bg: #332a29;
    --on-brand: #ffffff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1312;
  --surface: #241a19;
  --surface-2: #2e2120;
  --line: #432f2d;
  --fg: #f2e6e4;
  --muted: #b39d9a;
  --brand: #7a0d0d;
  --accent: #e0574a;
  --coral: #ef6b5c;
  --ok: #5fcf94;
  --ok-bg: #16331f;
  --ko: #ff7a6b;
  --ko-bg: #3d1a17;
  --na: #c2b6b4;
  --na-bg: #332a29;
  --on-brand: #ffffff;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.4;
}
button,
input {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.top {
  background: var(--brand);
  color: var(--on-brand);
  border-bottom: 5px solid var(--coral);
}
.top-in {
  max-width: 860px;
  margin: 0 auto;
  padding-block: 14px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex;
  gap: 14px;
  align-items: center;
}
.logo {
  width: 52px;
  height: 52px;
  border-radius: 9px;
  background: #fff;
  display: grid;
  place-items: center;
  flex: none;
}
.logo img {
  width: 46px;
  height: 46px;
}
.top h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: 0.02em;
  margin: 0;
  line-height: 1.05;
  text-wrap: balance;
}
.top p {
  margin: 2px 0 0;
  font-size: 0.85rem;
  opacity: 0.9;
}
.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 16px 120px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tabs {
  display: flex;
  gap: 6px;
}
.tab {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 10px;
  font-weight: 600;
  cursor: pointer;
}
.tab[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-brand);
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.ident {
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 12px;
}
@media (max-width: 620px) {
  .ident {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.f {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.f label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.f input {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 7px;
  padding: 9px 10px;
  min-width: 0;
  width: 100%;
}
.legend {
  font-size: 0.82rem;
  color: var(--muted);
}
.m {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}
.part {
  background: var(--brand);
  color: var(--on-brand);
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 8px 12px;
  border-left: 5px solid var(--coral);
  border-radius: 4px;
  margin-top: 6px;
}
details.sec {
  overflow: hidden;
}
details.sec > summary {
  list-style: none;
  cursor: pointer;
  background: var(--accent);
  color: var(--on-brand);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
details.sec > summary::-webkit-details-marker {
  display: none;
}
.sec-t {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  flex: 1;
  min-width: 0;
}
.cnt {
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  padding: 2px 9px;
  white-space: nowrap;
}
.cnt.bad {
  background: #fff;
  color: #c0392b;
  font-weight: 700;
}
.chev {
  transition: transform 0.15s;
}
details[open] .chev {
  transform: rotate(90deg);
}
.sec-tools {
  display: flex;
  justify-content: flex-end;
  padding: 8px 12px 0;
}
.allok {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.82rem;
  cursor: pointer;
  font-weight: 600;
}
.item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
}
.item:last-child {
  border-bottom: 0;
}
.it-t {
  min-width: 0;
}
.num {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  margin-right: 6px;
}
.seg {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.seg button {
  border: 0;
  background: var(--surface);
  padding: 8px 10px;
  min-width: 48px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}
.seg button + button {
  border-left: 1px solid var(--line);
}
.seg button[aria-pressed="true"][data-v="ok"] {
  background: var(--ok-bg);
  color: var(--ok);
}
.seg button[aria-pressed="true"][data-v="ko"] {
  background: var(--ko-bg);
  color: var(--ko);
}
.seg button[aria-pressed="true"][data-v="na"] {
  background: var(--na-bg);
  color: var(--na);
}
.obs {
  grid-column: 1/-1;
  display: flex;
  gap: 8px;
}
.obs input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 0.9rem;
}
.notebtn {
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  justify-self: start;
  grid-column: 1/-1;
}
.item.ko {
  background: var(--ko-bg);
}
@media (max-width: 520px) {
  .item {
    grid-template-columns: 1fr;
  }
  .seg {
    justify-self: start;
  }
}
.result {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.result h2,
.hist h2 {
  font-family: var(--display);
  font-size: 1.15rem;
  margin: 0;
  letter-spacing: 0.03em;
  color: var(--accent);
}
.choice {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.choice button {
  flex: 1;
  min-width: 150px;
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: 9px;
  padding: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}
.choice button[aria-pressed="true"][data-r="apto"] {
  border-color: var(--ok);
  background: var(--ok-bg);
  color: var(--ok);
}
.choice button[aria-pressed="true"][data-r="incidencia"] {
  border-color: var(--ko);
  background: var(--ko-bg);
  color: var(--ko);
}
.hint {
  font-size: 0.85rem;
  color: var(--ko);
  font-weight: 600;
}
.row2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}
@media (max-width: 520px) {
  .row2 {
    grid-template-columns: 1fr;
  }
}
.sig-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sig {
  border: 1.5px dashed var(--accent);
  border-radius: 9px;
  background: #fff;
  touch-action: none;
  width: 100%;
  height: 150px;
  display: block;
}
.sig-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
}
.link {
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-top: 10px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  z-index: 5;
}
.bar-in {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.prog {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.prog-t {
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.prog-t b {
  color: var(--fg);
}
.track {
  height: 6px;
  border-radius: 4px;
  background: var(--surface-2);
  overflow: hidden;
}
.track i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s;
}
.btn {
  border: 0;
  border-radius: 9px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  background: var(--accent);
  color: var(--on-brand);
  white-space: nowrap;
}
.btn.sec2 {
  background: var(--surface-2);
  color: var(--fg);
  border: 1px solid var(--line);
}
.btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.msg {
  padding: 12px 14px;
  border-radius: 9px;
  font-size: 0.9rem;
  font-weight: 500;
}
.msg.err {
  background: var(--ko-bg);
  color: var(--ko);
}
.msg.ok {
  background: var(--ok-bg);
  color: var(--ok);
}
.hist {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hrow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.hrow .who {
  font-weight: 600;
}
.hrow .meta {
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.pill {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-radius: 20px;
  padding: 3px 9px;
  text-transform: uppercase;
}
.pill.apto {
  background: var(--ok-bg);
  color: var(--ok);
}
.pill.incidencia {
  background: var(--ko-bg);
  color: var(--ko);
}
.hacts {
  display: flex;
  gap: 8px;
  align-items: center;
  grid-column: 1/-1;
}
.empty {
  color: var(--muted);
  font-size: 0.92rem;
  padding: 8px 0;
}
.search {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 7px;
  padding: 9px 10px;
  width: 100%;
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
.types {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 560px) {
  .types {
    grid-template-columns: 1fr;
  }
}
.type {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  border-top: 4px solid var(--accent);
  transition:
    transform 0.12s,
    border-color 0.12s;
}
.type:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.type-n {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.03em;
  line-height: 1.1;
}
.type-d {
  color: var(--muted);
  font-size: 0.9rem;
}
.type-m {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.pick-h {
  font-family: var(--display);
  font-size: 1.25rem;
  margin: 4px 0 0;
  letter-spacing: 0.03em;
}
.pick-p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.unitbar {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.unitbar .lbl {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.unitbar .nm {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.03em;
}
.unitbar .grow {
  flex: 1;
  min-width: 0;
}
.confirm {
  grid-column: 1/-1;
  width: 100%;
  background: var(--ko-bg);
  color: var(--ko);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.9rem;
  font-weight: 500;
}
.confirm .grow {
  flex: 1;
  min-width: 180px;
}
.btn.sm {
  padding: 8px 12px;
  font-size: 0.85rem;
}
.hfil {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.hfil select {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 7px;
  padding: 9px 10px;
}
.hfil .search {
  flex: 1;
  min-width: 180px;
  width: auto;
}
.q {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.q-t {
  font-weight: 600;
  font-size: 1.02rem;
}
.q-h {
  font-size: 0.85rem;
  color: var(--muted);
}
.yn {
  display: flex;
  gap: 8px;
}
.yn button {
  flex: 1;
  max-width: 160px;
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: 9px;
  padding: 10px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}
.yn button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--surface-2);
  color: var(--accent);
}
.cfgsum {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 2px;
}
.tpill {
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2px 8px;
  color: var(--muted);
  white-space: nowrap;
}

/* ===================== Añadidos: acceso, sesión, borradores, equipo ===================== */
.top-in .grow { flex: 1; min-width: 0; }
.user { display: flex; align-items: center; gap: 10px; font-size: 0.82rem; text-align: right; }
.user .who { line-height: 1.2; }
.user .who small { display: block; opacity: 0.8; }
.user button { border: 1px solid rgba(255,255,255,.5); background: transparent; color: #fff; border-radius: 7px; padding: 6px 10px; cursor: pointer; font-weight: 600; font-size: 0.8rem; }
@media (max-width: 560px) { .user .who { display: none; } }
.login { padding: 28px 20px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; max-width: 520px; margin: 24px auto 0; }
.login h2 { font-family: var(--display); font-size: 1.4rem; margin: 0; color: var(--accent); letter-spacing: .03em; }
.login p { margin: 0; color: var(--muted); }
.gbtn { display: inline-flex; align-items: center; gap: 10px; background: #fff; color: #1f1f1f; border: 1px solid #dadce0; border-radius: 9px; padding: 11px 18px; font-weight: 600; cursor: pointer; }
.gbtn svg { width: 18px; height: 18px; }
.drafts { padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.drafts h2 { font-family: var(--display); font-size: 1.15rem; margin: 0 0 4px; letter-spacing: .03em; color: var(--accent); }
.drow { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.drow .who { font-weight: 600; }
.drow .meta { font-size: 0.82rem; color: var(--muted); }
.drow .acts { display: flex; gap: 8px; }
.sync { font-size: 0.75rem; color: var(--muted); }
.sync.err { color: var(--ko); font-weight: 600; }
.locked .ident, .locked #sections, .locked .choice, .locked .row2, .locked .sig-wrap, .locked #btn-type { pointer-events: none; opacity: .65; }
.team { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.team h2 { font-family: var(--display); font-size: 1.15rem; margin: 0; letter-spacing: .03em; color: var(--accent); }
.team .add { display: flex; gap: 8px; flex-wrap: wrap; }
.team .add input { flex: 1; min-width: 200px; border: 1px solid var(--line); background: var(--bg); border-radius: 7px; padding: 9px 10px; }
.team select, .hfil select { border: 1px solid var(--line); background: var(--bg); border-radius: 7px; padding: 8px; color: var(--fg); }
.trow { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 6px 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.trow .meta { font-size: 0.8rem; color: var(--muted); }
.trow.off { opacity: .55; }
.tag { font-size: .7rem; font-weight: 700; border-radius: 20px; padding: 2px 8px; background: var(--surface-2); color: var(--muted); }
.tag.err { background: var(--ko-bg); color: var(--ko); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
