/*
 * Estilos de TortuID. La paleta, tipografía y componentes (botones, barra superior,
 * menú lateral, tablas, tarjeta de inicio) se portaron de turtle_labeling_app.html para
 * que la app de coordinación y la app de etiquetado se vean como una sola herramienta.
 */
/*
 * Variables. La paleta base (arena, océano, aceptar, rechazar) viene del HTML de etiquetado.
 * Los componentes usan los tokens semánticos (--page, --surface, --text, --heading…) y el
 * tema oscuro solo cambia esos tokens: con prefers-color-scheme, o fijo con data-theme en <html>.
 * Los dos bloques oscuros son idénticos a propósito (CSS no permite compartirlos sin preprocesador).
 */
:root {
  color-scheme: light;
  --ink: #0f2027;
  --ocean-deep: #0b3d47;
  --ocean: #14636f;
  --ocean-light: #4a9ba6;
  --sand: #f6f3ec;
  --sand-dim: #ece7db;
  --accept: #2f8f5b;
  --accept-bg: #e3f4ea;
  --reject: #b3492f;
  --warn-bg: #fbeee7;
  --amber: #e0a83e;
  --line: #d8d2c2;
  --white: #ffffff;
  --muted: #777;
  --text-soft: #555;          /* subtítulos */
  --muted-2: #999;            /* pie de página, filas inactivas */
  --muted-3: #aaa;            /* marcador de logo */
  --disabled: #bbb;           /* botón deshabilitado */
  --info-bg: #e3eef4;         /* etiquetas "en selección / en curación" */
  --amber-bg: #fdf0d5;        /* etiquetas y avisos ámbar */
  --amber-ink: #6b4e00;
  --highlight-bg: #fffaf0;    /* "Qué sigue" cuando me toca a mí */
  --on-dark: rgba(255,255,255,0.75);        /* texto sobre barra y menú */
  --on-dark-line: rgba(255,255,255,0.15);
  --on-dark-border: rgba(255,255,255,0.5);
  --on-dark-hover: rgba(255,255,255,0.08);
  --on-dark-hover-strong: rgba(255,255,255,0.12);
  /* Tokens semánticos */
  --page: var(--sand);           /* fondo de la página */
  --surface: var(--white);       /* paneles, tablas, tarjetas */
  --surface-dim: var(--sand-dim);/* encabezados de tabla, etiquetas */
  --text: var(--ink);
  --heading: var(--ocean-deep);  /* títulos, etiquetas de campo */
  --accent: var(--ocean-deep);   /* bordes de botón secundario, punto actual */
  --link: var(--ocean);
  --bar-bg: var(--ocean-deep);   /* barra superior */
  --nav-bg: var(--ocean);        /* menú lateral */
  --btn-bg: var(--ocean-deep);
  --btn-hover: var(--ocean);
  --turtle-opacity: 0.34;
  /* Avatares de iniciales: seis tonos de la paleta */
  --avatar-1: var(--ocean-deep);
  --avatar-2: var(--ocean);
  --avatar-3: var(--ocean-light);
  --avatar-4: var(--accept);
  --avatar-5: var(--amber);
  --avatar-6: var(--reject);
}
/* Tema oscuro: sigue al sistema (salvo que la persona fije claro) o se fija con data-theme="dark". */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0f1a1e;
    --surface: #16262c;
    --surface-dim: #1e3138;
    --text: #e6ebec;
    --heading: #cfe6ea;
    --accent: #8ecbd3;
    --link: #7fc4cd;
    --bar-bg: #08252c;
    --nav-bg: #0d3a43;
    --btn-bg: #14636f;
    --btn-hover: #1f7f8c;
    --line: #2d434b;
    --muted: #9aa7ab;
    --text-soft: #b8c2c5;
    --muted-2: #7d8b90;
    --muted-3: #6a787d;
    --disabled: #4a575c;
    --accept: #5fc48a;
    --accept-bg: #16352a;
    --reject: #e8876c;
    --warn-bg: #3b1f18;
    --amber-bg: #3a2d10;
    --amber-ink: #f0c66a;
    --info-bg: #1a3340;
    --highlight-bg: #2a2416;
    --turtle-opacity: 0.22;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f1a1e;
  --surface: #16262c;
  --surface-dim: #1e3138;
  --text: #e6ebec;
  --heading: #cfe6ea;
  --accent: #8ecbd3;
  --link: #7fc4cd;
  --bar-bg: #08252c;
  --nav-bg: #0d3a43;
  --btn-bg: #14636f;
  --btn-hover: #1f7f8c;
  --line: #2d434b;
  --muted: #9aa7ab;
  --text-soft: #b8c2c5;
  --muted-2: #7d8b90;
  --muted-3: #6a787d;
  --disabled: #4a575c;
  --accept: #5fc48a;
  --accept-bg: #16352a;
  --reject: #e8876c;
  --warn-bg: #3b1f18;
  --amber-bg: #3a2d10;
  --amber-ink: #f0c66a;
  --info-bg: #1a3340;
  --highlight-bg: #2a2416;
  --turtle-opacity: 0.22;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--page);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; margin: 0; font-weight: 600; }
a { color: var(--link); }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-block;
  padding: 11px 22px;
  background: var(--btn-bg);
  color: var(--white);
  border: none;
  border-radius: 3px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.02em;
  text-decoration: none;
  line-height: 1.2;
  font-family: inherit;
}
.btn:hover { background: var(--btn-hover); color: var(--white); }
.btn:disabled { background: var(--disabled); cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--accent); border: 1px solid var(--accent); }
.btn.secondary:hover { background: var(--surface-dim); color: var(--accent); }
.btn.danger { background: var(--surface); color: var(--reject); border: 1px solid var(--reject); }
.btn.danger:hover { background: var(--warn-bg); color: var(--reject); }
.btn.small { padding: 6px 12px; font-size: 12px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Formularios ---------- */
label.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--heading);
  margin: 18px 0 6px 0;
}
input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 14px;
  background: var(--page);
  font-family: inherit;
  color: var(--text);
}
.card input[type=text], .card input[type=email], .card input[type=password], .card select { background: var(--page); }
.content input[type=text], .content input[type=email], .content select, .content textarea { background: var(--surface); }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.checkbox-row:last-child { border-bottom: none; }
.checkbox-row input { margin-top: 3px; }
.checkbox-row b { display: block; font-size: 13px; color: var(--heading); }
.checkbox-row span { font-size: 12px; color: var(--muted); }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 26px; }
.form-errors {
  background: var(--warn-bg);
  border: 1px solid var(--reject);
  color: var(--reject);
  border-radius: 3px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}
.form-errors ul { margin: 4px 0 0 0; padding-left: 18px; }

/* ---------- Tarjeta de inicio (login, contraseña) ---------- */
.card {
  max-width: 480px;
  margin: 8vh auto;
  padding: 40px;
  background: var(--surface);
  border-radius: 4px;
  border: 1px solid var(--line);
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: var(--link);
  font-weight: 600;
  margin-bottom: 8px;
}
.card h1 { font-size: 26px; color: var(--heading); margin-bottom: 6px; }
.card p.sub { color: var(--text-soft); margin: 0 0 20px 0; font-size: 14px; }
.card .btn { margin-top: 26px; width: 100%; }
.card .links { margin-top: 18px; font-size: 12px; text-align: center; }
.card .links a { color: var(--link); }
.card label.check-label { font-weight: normal; display: flex; gap: 8px; align-items: center; }
.card .links.lang a { margin: 0 6px; color: var(--muted); }
.card .links.lang a.current { color: var(--heading); font-weight: 600; text-decoration: none; }
.radio-row { display: flex; gap: 8px; align-items: center; padding: 6px 0; font-size: 13px; }
.radio-row input { width: auto; margin: 0; }

/* ---------- Estructura de la app ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
/* ---------- Accesibilidad ---------- */
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 8px 14px; background: var(--btn-bg); color: var(--white); border-radius: 3px; font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
header.topbar :focus-visible, .sidebar :focus-visible { outline-color: var(--white); }
#contenido:focus { outline: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

header.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  background: var(--bar-bg);
  color: var(--white);
  flex-shrink: 0;
  gap: 16px;
}
header.topbar .title { font-family: Georgia, serif; font-size: 17px; color: var(--white); text-decoration: none; }
header.topbar .title span { color: var(--ocean-light); font-size: 12px; margin-left: 10px; }
header.topbar .meta { font-size: 12px; opacity: 0.85; display: flex; align-items: center; gap: 12px; }
/* Menú de la persona (nombre ▾): Mi cuenta y Salir. <details> para no depender de JavaScript. */
header.topbar .user-menu { position: relative; }
header.topbar .user-menu summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; color: var(--white); font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 3px; border: 1px solid var(--on-dark-border); }
header.topbar .user-menu summary::-webkit-details-marker { display: none; }
header.topbar .user-menu summary:hover, header.topbar .user-menu[open] summary { background: var(--on-dark-hover-strong); }
header.topbar .user-menu-items { position: absolute; right: 0; top: calc(100% + 6px); min-width: 170px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 6px 18px rgba(0,0,0,0.18); z-index: 20; padding: 6px 0; }
header.topbar .user-menu-items a, header.topbar .user-menu-items button { display: block; width: 100%; text-align: left; padding: 8px 14px; font-size: 13px; color: var(--text); background: none; border: none; cursor: pointer; text-decoration: none; font-family: inherit; }
header.topbar .user-menu-items a:hover, header.topbar .user-menu-items button:hover { background: var(--surface-dim); }
header.topbar .user-menu-items form { margin: 0; }
header.topbar .btn.secondary { background: transparent; color: var(--white); border-color: var(--on-dark-border); }
header.topbar .btn.secondary:hover { background: var(--on-dark-hover-strong); }
/* Menú lateral: objetos (Mi trabajo, Manifiestos, Supervisión, Datasets); abajo administración y acerca de. */
.shell { display: flex; flex: 1; min-height: 0; }
.sidebar { width: 200px; flex-shrink: 0; background: var(--nav-bg); display: flex; flex-direction: column; padding: 14px 0; }
.side-nav { display: flex; flex-direction: column; }
.side-nav a {
  display: block;
  padding: 10px 20px;
  color: var(--on-dark);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.side-nav a.active, .side-nav a:hover { color: var(--white); background: var(--on-dark-hover); border-left-color: var(--sand); }
.side-nav.bottom { margin-top: auto; border-top: 1px solid var(--on-dark-line); padding-top: 8px; }
.content { flex: 1; padding: 26px 32px; max-width: 1100px; width: 100%; margin: 0 auto; position: relative; }
.content > * { position: relative; z-index: 1; }
.fondo-tortuga {
  position: absolute; right: 0; bottom: 36px; z-index: 0;
  width: min(520px, 60%); aspect-ratio: 16 / 9;
  background: url("/assets/tortuga-fondo-8c26d575.webp") no-repeat right bottom / contain;
  opacity: var(--turtle-opacity); pointer-events: none;
  -webkit-mask-image: linear-gradient(to top, transparent 0, #000 22%);
  mask-image: linear-gradient(to top, transparent 0, #000 22%);
}
.content.wide .fondo-tortuga { display: none; }
.fondo-tortuga.fijo { position: fixed; right: 3vw; bottom: 24px; width: min(520px, 70vw); }
.content h2 { font-size: 20px; color: var(--heading); margin-bottom: 4px; }
.content h3 { font-size: 15px; color: var(--heading); margin: 22px 0 8px 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }
.page-head h3 { margin: 0; }
.page-head.tight { margin-bottom: 10px; }
.content h3 .note { font-weight: normal; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 22px 26px; max-width: 640px; }
.footer-hint { padding: 8px 22px; font-size: 11px; color: var(--muted-2); border-top: 1px solid var(--line); background: var(--surface); flex-shrink: 0; }

/* ---------- Avisos ---------- */
.flash { padding: 10px 22px; font-size: 13px; border-bottom: 1px solid var(--line); }
.flash.notice { background: var(--accept-bg); color: var(--accept); }
.flash.alert { background: var(--warn-bg); color: var(--reject); }

/* ---------- Tablas ---------- */
table.review-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; }
table.review-table th, table.review-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
table.review-table tr:last-child td { border-bottom: none; }
table.review-table th { color: var(--heading); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; background: var(--surface-dim); }
table.review-table tr.inactive td { color: var(--muted-2); }
td.actions { white-space: nowrap; text-align: right; }
td.actions form { display: inline; }

/* ---------- Etiquetas de perfil ---------- */
.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 2px;
  background: var(--surface-dim);
  color: var(--heading);
  margin: 1px 4px 1px 0;
  white-space: nowrap;
}
.tag.administrador { background: var(--btn-bg); color: var(--white); }
.tag.inactive { background: var(--warn-bg); color: var(--reject); }

/* ---------- Tarjetas de rol en el inicio ---------- */
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 18px; }
.role-card { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 18px 20px; }
.role-card h3 { margin: 0 0 6px 0; }
.role-card p { margin: 0 0 12px 0; font-size: 13px; color: var(--muted); }
.role-card .soon { font-size: 11px; color: var(--amber); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; flex-direction: row; flex-wrap: wrap; justify-content: space-between; padding: 0 8px; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-nav a { border-left: none; border-bottom: 3px solid transparent; padding: 10px 12px; }
  .side-nav a.active, .side-nav a:hover { border-left-color: transparent; border-bottom-color: var(--sand); }
  .side-nav.bottom { margin-top: 0; border-top: none; padding-top: 0; }
}
@media (max-width: 640px) {
  .content { padding: 18px 16px; }
  .card { margin: 16px; padding: 24px; }
  header.topbar { flex-wrap: wrap; }
}

/* ---------- Manifiestos y asignaciones ---------- */
.tag.estado-cargado { background: var(--surface-dim); color: var(--heading); }
.tag.estado-rechazado { background: var(--warn-bg); color: var(--reject); }
.tag.estado-en_seleccion { background: var(--info-bg); color: var(--link); }
.tag.estado-en_consenso { background: var(--amber-bg); color: var(--amber-ink); }
.tag.estado-en_curacion { background: var(--info-bg); color: var(--link); }
.tag.estado-en_consolidacion { background: var(--amber-bg); color: var(--amber-ink); }
.tag.estado-cerrado { background: var(--accept-bg); color: var(--accept); }
.page-head h2 .tag { vertical-align: middle; margin-left: 6px; }
.form-warnings {
  background: var(--amber-bg); border: 1px solid var(--amber); color: var(--amber-ink);
  border-radius: 3px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px;
}
.form-warnings ul, .form-errors ul { margin: 4px 0 0 0; padding-left: 18px; }
.form-ok { background: var(--accept-bg); border: 1px solid var(--accept); color: var(--accept); border-radius: 3px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 22px; }
.two-col .panel { max-width: none; }
dl.data { margin: 0; font-size: 13px; }
dl.data dt { font-weight: 600; color: var(--heading); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 10px; }
dl.data dd { margin: 2px 0 0 0; word-break: break-all; }
.inline-form { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.inline-form select { width: auto; flex: 1; padding: 7px 10px; font-size: 13px; }
table.review-table.compact td { padding: 6px 8px; }
table.review-table.spaced { margin-top: 6px; }
details.done-list { margin: 4px 0 12px 0; }
details.batches-list { margin: -10px 0 18px 0; }
p.list-caption { margin: 12px 0 4px 0; }
p.list-caption.first { margin-top: 0; }
ul.rules { padding-left: 18px; margin: 0; }
input[type=file] { font-size: 13px; }
.pw-field { position: relative; }
.pw-field input { padding-right: 42px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--muted); border-radius: 3px; cursor: pointer; padding: 0; }
.pw-toggle:hover { color: var(--heading); background: var(--surface-dim); }
.pw-toggle .slash { display: none; }
.pw-field.visible .pw-toggle .slash { display: block; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- Entregas y cobertura ---------- */
.tag.entrega-valida { background: var(--accept-bg); color: var(--accept); }
.tag.entrega-con_avisos { background: var(--amber-bg); color: var(--amber-ink); }
.tag.entrega-rechazada { background: var(--warn-bg); color: var(--reject); }
table.review-table tr.listo td { background: var(--accept-bg); }
table.review-table tr.listo td.mono { color: var(--accept); }
.panel.assignment { max-width: none; margin-bottom: 16px; }
.panel.assignment .page-head { margin-bottom: 8px; }
.panel.assignment .two-col { margin-bottom: 0; margin-top: 10px; }
.panel.assignment .inline-form { margin-top: 8px; }
td.form-warnings, td.form-errors { border-radius: 0 !important; }

/* ---------- Inicio: presentación del proyecto ---------- */
.hero { display: flex; gap: 26px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 26px 28px; margin-bottom: 26px; }
.hero-mark { width: 96px; height: 96px; flex-shrink: 0; }
.hero-text { flex: 1; }
.hero-text h2 { font-size: 22px; margin-bottom: 8px; }
.hero-text p { margin: 0 0 10px 0; font-size: 14px; max-width: 640px; }
.hero-logos { display: flex; flex-direction: column; gap: 10px; align-items: center; flex-shrink: 0; }
.hero-logos img.hero-logo { max-width: 160px; max-height: 110px; background: var(--white); }
.logo-placeholder { width: 140px; height: 80px; border: 1px dashed var(--line); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted-3); text-align: center; padding: 8px; }
@media (max-width: 760px) { .hero { flex-direction: column; } .hero-logos { align-items: flex-start; } }

/* ---------- Bandeja "Mi trabajo" ---------- */
.inbox-section { margin-bottom: 28px; }
.inbox-section > h3 { margin-top: 0; }
.inbox-empty { max-width: none; padding: 14px 18px; color: var(--muted); font-size: 13px; }
.inbox-table td.actions { text-align: right; white-space: nowrap; }

/* ---------- Tortugas: línea de avance, siguiente paso y etapas ---------- */
ol.steps { list-style: none; display: flex; gap: 0; padding: 0; margin: 0 0 16px 0; counter-reset: step; flex-wrap: wrap; }
ol.steps li { flex: 1; min-width: 110px; position: relative; padding: 0 8px 0 0; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; align-items: flex-start; gap: 6px; line-height: 1.2; }
ol.steps li::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 2px; background: var(--line); z-index: 0; }
ol.steps li .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--page); border: 2px solid var(--line); flex-shrink: 0; position: relative; z-index: 1; }
ol.steps li.done { color: var(--accept); }
ol.steps li.done::before { background: var(--accept); }
ol.steps li.done .dot { background: var(--accept); border-color: var(--accept); }
ol.steps li.current { color: var(--heading); font-weight: 700; }
ol.steps li.current .dot { background: var(--surface); border-color: var(--accent); border-width: 3px; }
ol.steps.rejected li.current { color: var(--reject); }
ol.steps.rejected li.current .dot { border-color: var(--reject); }
.next-step { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 4px; padding: 12px 18px; margin-bottom: 20px; font-size: 13px; }
.next-step b { color: var(--heading); margin-right: 6px; }
.next-step.mine { border-left-color: var(--amber); background: var(--highlight-bg); }
.stage { margin-bottom: 8px; padding-left: 12px; border-left: 3px solid transparent; }
.stage.current { border-left-color: var(--amber); }
.stage > h3 { margin-top: 14px; }
.stage .panel { max-width: none; }
.stage .panel.muted { display: flex; align-items: center; }
.stage table.compact td { white-space: nowrap; }
.stage table.compact td.wrap { white-space: normal; }
.stage .two-col.deliveries { grid-template-columns: minmax(240px, 1fr) 2fr; }
@media (max-width: 760px) { .stage .two-col.deliveries { grid-template-columns: 1fr; } }
.stage .panel { overflow-x: auto; }
.stage table.compact td:first-child { white-space: normal; }
.stage .downloads { margin-top: 8px; }

/* ---------- Tortugas: tarjetas ---------- */
.turtle-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.turtle-card { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 18px 20px 14px; display: flex; flex-direction: column; gap: 12px; }
.turtle-card.mine { border-color: var(--amber); }
.turtle-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.turtle-card .t-id { font-family: Georgia, "Times New Roman", serif; font-size: 20px; font-weight: 700; color: var(--heading); text-decoration: none; }
.turtle-card .t-id:hover { text-decoration: underline; }
.progress .progress-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.progress progress { width: 100%; height: 8px; border: none; border-radius: 999px; overflow: hidden; background: var(--surface-dim); -webkit-appearance: none; appearance: none; }
.progress progress::-webkit-progress-bar { background: var(--surface-dim); border-radius: 999px; }
.progress progress::-webkit-progress-value { background: var(--accept); border-radius: 999px; }
.progress progress::-moz-progress-bar { background: var(--accept); border-radius: 999px; }
.turtle-card .team { display: flex; flex-direction: column; gap: 4px; }
.turtle-card .team .empty { padding: 2px 0 6px; }
.people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; padding: 2px 0 6px; }
.people .person { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person { display: inline-flex; align-items: center; gap: 7px; vertical-align: middle; }
.people .person { font-size: 13px; }
.person .avatar.small { margin-right: -2px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; font-size: 11px; font-weight: 700; color: var(--white); letter-spacing: 0.02em; flex-shrink: 0; }
.avatar.hue-1 { background: var(--avatar-1); } .avatar.hue-2 { background: var(--avatar-2); } .avatar.hue-3 { background: var(--avatar-3); }
.avatar.hue-4 { background: var(--avatar-4); } .avatar.hue-5 { background: var(--avatar-5); } .avatar.hue-6 { background: var(--avatar-6); }
.avatar.photo { object-fit: cover; background: var(--surface-dim); }
.avatar.small { width: 22px; height: 22px; font-size: 9px; vertical-align: middle; }
.avatar.big { width: 72px; height: 72px; font-size: 24px; }
.avatar-block { margin: 6px 0 4px; }
.turtle-card .artifacts { border-top: 1px solid var(--line); padding-top: 10px; }
.turtle-card footer.next-step { margin: 0; padding: 10px 12px; }

/* ---------- Panorama ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.stat .num { font-family: Georgia, "Times New Roman", serif; font-size: 28px; font-weight: 700; color: var(--heading); line-height: 1.1; }
.stat .lbl { font-size: 12px; color: var(--muted); }
.two-col.overview, .two-col.account { align-items: start; }
.two-col .stack { display: flex; flex-direction: column; gap: 16px; }
.two-col .stack .panel { max-width: none; }
.two-col.overview .panel { padding: 18px 20px; }
.progress-list, .people-list, .activity-list { list-style: none; margin: 0; padding: 0; }
.progress-list li { padding: 8px 0; border-top: 1px solid var(--line); }
.progress-list li:first-child { border-top: none; padding-top: 0; }
.progress-list .progress-head a { font-weight: 700; color: var(--heading); text-decoration: none; }
.progress-list .progress-head a:hover { text-decoration: underline; }
.progress-list .tag { margin-left: 6px; vertical-align: middle; }
.line { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.people-list .line:first-child, .activity-list .line:first-child { border-top: none; padding-top: 0; }
.line > span:nth-child(2) { display: flex; flex-direction: column; gap: 1px; }
.activity-list .line > span:nth-child(2) { display: block; font-size: 13px; }
.panel.activity { max-width: none; padding: 18px 20px; }

/* ---------- Mi trabajo: ahora e historial; avance del etiquetador ---------- */
.work-tiles .progress { margin-bottom: 12px; }
.stats.achievements { margin-bottom: 16px; }
.stat .num.duration { font-size: 22px; white-space: nowrap; }
.stats.compact .num.duration { font-size: 17px; }
.stats.compact { gap: 10px; margin-bottom: 0; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.stats.compact .stat { padding: 10px 12px; background: var(--page); }
.stats.compact .num { font-size: 20px; }
.stats.compact .num .of { font-size: 13px; color: var(--muted); font-weight: 400; }
.stats.compact .num.small-num { font-size: 14px; font-family: inherit; line-height: 1.6; }
.backup-box { margin-top: 10px; font-size: 13px; }
.backup-box summary { cursor: pointer; color: var(--muted); }
.backup-box .two-col { margin: 10px 0 0; }
.backup-box .list-caption { margin: 8px 0 0; }
.history { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.history-row { display: grid; grid-template-columns: 150px 1fr; gap: 14px; padding: 10px 0 14px 18px; position: relative; }
.history-row::before { content: ""; position: absolute; left: -6px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.history-row.current { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: 0 4px 4px 0; margin-left: -2px; padding: 14px 18px 14px 20px; }
.history-row.current::before { left: -8px; background: var(--amber); border-color: var(--amber); }
.history-row .when .now { color: var(--amber-ink); text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; }
.history-row .progress.slim { margin: 10px 0 4px; max-width: 520px; }
.history-row .what b { font-size: 15px; color: var(--heading); margin-right: 4px; }
.history-row .what .tag { vertical-align: middle; }
.history-row details { margin-top: 6px; }
.history-row details summary { cursor: pointer; }
.work-strip { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 12px 16px; margin-bottom: 8px; }
.work-strip .work-tiles .progress { margin-bottom: 10px; }
@media (max-width: 760px) { .history-row { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- Asignar con casillas ---------- */
.team-picker { list-style: none; margin: 6px 0 0; padding: 0; }
.team-picker li { margin: 0; }
.team-picker form { margin: 0; }
.pick-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 6px; border: none; background: none; border-radius: 3px; cursor: pointer; text-align: left; font: inherit; font-size: 13px; color: var(--text); }
.pick-row:hover { background: var(--surface-dim); }
.pick-row .person { flex: 1; }
.pick-row .box { width: 16px; height: 16px; border: 1.5px solid var(--muted); border-radius: 3px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--page); }
.pick-row.checked .box { background: var(--accent); border-color: var(--accent); }
.pick-row.checked .box::after { content: ""; width: 4px; height: 8px; border: solid var(--white); border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.pick-row.busy { cursor: default; opacity: 0.6; }
.pick-row.busy:hover { background: none; }
.picker-drop { position: relative; }
.picker-drop summary { list-style: none; display: inline-block; user-select: none; }
.picker-drop summary::-webkit-details-marker { display: none; }
.picker-drop .team-picker { position: absolute; left: 0; top: calc(100% + 6px); min-width: 280px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 6px 18px rgba(0,0,0,0.18); padding: 6px; z-index: 20; }
.turtle-card footer.next-step { overflow: visible; }
.team-picker .picker-done { display: none; }
.picker-drop .team-picker .picker-done, .team-picker .picker-done.pending { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 6px 6px 2px; border-top: 1px solid var(--line); margin-top: 4px; }
.team-picker .picker-done form { margin: 0; }
.team-picker li.form-errors { margin: 0 0 6px; }

/* ---------- Etiquetador embebido ---------- */
/* La página del Etiquetador cabe en la ventana: el marco toma el alto que sobra y nada desborda
   (menú lateral y pie siempre a la vista). Las demás páginas siguen creciendo con su contenido. */
.app:has(.content.wide) { height: 100vh; }
.content.wide { max-width: none; padding: 10px 14px 14px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.content.wide .embed { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.embed-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.embed-head b { color: var(--heading); margin-right: 8px; }
.embed-stage { margin: 0 0 2px; font-size: 22px; }
.embed-sub { color: var(--muted); }
.embed-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 8px; }
.embed-actions .btn:disabled { opacity: 0.55; }
.embed-frame { flex: 1; width: 100%; min-height: 220px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }

/* Consenso en TortuID: datos fijos, un ajuste, cuatro escenarios a la vez y un botón. */
.consenso .panel { max-width: none; margin-bottom: 12px; }
.consenso-facts .facts-line { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; font-size: 14px; }
.consenso-facts .facts-line b { font-size: 18px; color: var(--heading); margin-right: 4px; }
.consenso-facts .facts-line .sep { width: 1px; height: 22px; background: var(--line); align-self: center; }
.consenso-facts .facts-line .decides { background: var(--warn-bg); border-radius: 3px; padding: 2px 8px; }
.consenso-facts p { margin: 8px 0 0; }
.consenso .gap-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 14px 0 0; }
.consenso .gap-line input { width: 64px; padding: 3px 6px; font-size: 13px; }
.consenso .batches-detail summary { cursor: pointer; }
.consenso .batches-detail table { margin-top: 8px; max-height: 360px; overflow: auto; display: block; }
.review-table tr.sin-consenso td { color: var(--muted); }
.rule-options { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.rule-option { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; background: var(--page); }
.rule-option.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.rule-option .letter { font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: 20px; color: var(--heading); width: 24px; text-align: center; }
.rule-option .text { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.rule-option .n-field input { width: 64px; padding: 3px 6px; }
.rule-option .pool { text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.rule-option .pool .num { font-family: Georgia, "Times New Roman", serif; font-size: 26px; color: var(--heading); line-height: 1.1; }
.rule-option .pool .lbl { font-size: 11px; color: var(--muted); }
.consenso-rules p { margin: 10px 0 0; }
@media (max-width: 720px) { .rule-option { grid-template-columns: auto auto 1fr; } .rule-option .pool { grid-column: 1 / -1; align-items: flex-start; } }

/* Panel de avance del Etiquetador: números grandes (ahora) y, debajo, lo guardado en TortuID. */
.work-legend { margin: 0 0 10px; }
.stats.big { gap: 12px; margin-bottom: 8px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stats.big .stat { padding: 12px 14px; background: var(--page); align-items: center; text-align: center; }
.stats.big .stat .db { width: 100%; }
.stats.big .num { font-size: 32px; }
.stats.big .num .of { font-size: 14px; color: var(--muted); font-weight: 400; }
.stats.big .lbl { font-size: 12px; color: var(--muted); }
.stat .db { font-size: 12px; color: var(--muted); margin-top: 6px; border-top: 1px dashed var(--line); padding-top: 6px; }
.work-meta { margin: 4px 0 0; }
.stat progress.tile-bar { width: 100%; height: 6px; margin-top: 8px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 3px; background: var(--surface-dim); overflow: hidden; }
.stat progress.tile-bar::-webkit-progress-bar { background: var(--surface-dim); border-radius: 3px; }
.stat progress.tile-bar::-webkit-progress-value { background: var(--accept); border-radius: 3px; }
.stat progress.tile-bar::-moz-progress-bar { background: var(--accept); border-radius: 3px; }

/* Celebración al terminar una tortuga: confeti unos segundos y de vuelta a Mi trabajo. */
.celebration { position: fixed; inset: 0; z-index: 100; background: rgba(10, 30, 34, 0.72); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.celebration i { position: absolute; top: -12px; width: 10px; height: 16px; border-radius: 2px; opacity: 0.95; animation: confetti-fall 3s linear forwards; }
.celebration-box { background: var(--surface); color: var(--text); border-radius: 8px; padding: 32px 40px; text-align: center; max-width: 440px; box-shadow: 0 18px 50px rgba(0,0,0,0.35); animation: celebration-pop 0.5s ease-out; }
.celebration-box .emoji { font-size: 56px; line-height: 1; margin-bottom: 10px; }
.celebration-box h2 { margin: 0 0 8px; color: var(--heading); }
.celebration-box p { margin: 0; color: var(--muted); }
@keyframes confetti-fall { 0% { transform: translateY(-20px) rotate(0deg); } 100% { transform: translateY(105vh) rotate(720deg); } }
@keyframes celebration-pop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .celebration i { display: none; } .celebration-box { animation: none; } }

/* Mi trabajo: lo ya terminado por la persona se distingue de un vistazo. */
.history-row .when .done { color: var(--accept); }
.tag.done { background: var(--accept-bg); color: var(--accept); }

.selector-progress { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; align-items: center; }
.selector-progress .avatar { vertical-align: middle; }

/* Mi trabajo: una tarjeta por tarea pendiente (coordinación y supervisión). */
.task-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.task-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 4px; padding: 16px 18px 14px; display: flex; flex-direction: column; gap: 12px; }
.task-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.task-card .t-id { font-family: Georgia, "Times New Roman", serif; font-size: 20px; font-weight: 700; color: var(--heading); text-decoration: none; }
.task-card .facts { display: flex; flex-direction: column; gap: 6px; color: var(--text); }
.task-card .facts .error { color: var(--reject); }
.task-card .people-progress { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.task-card .people-progress .person { display: inline-flex; align-items: center; gap: 6px; }
.task-card footer { margin-top: auto; }

/* Ficha de la tortuga: una tarjeta por etapa, la actual abierta; detalles técnicos al final. */
.stage-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 4px; margin-bottom: 10px; }
.stage-card.current { border-left-color: var(--amber); }
.stage-card.tech { border-left-color: var(--line); background: var(--page); }
.stage-card > summary { list-style: none; display: grid; grid-template-columns: 34px auto 1fr; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; }
.stage-card > summary::-webkit-details-marker { display: none; }
.stage-card > summary::after { content: "▸"; color: var(--muted); grid-column: 4; }
.stage-card[open] > summary::after { content: "▾"; }
.stage-card > summary { grid-template-columns: 34px auto 1fr auto; }
.stage-card .stage-no { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-dim); color: var(--heading); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.stage-card.current .stage-no { background: var(--amber); color: var(--white); }
.stage-card .stage-title { font-family: Georgia, "Times New Roman", serif; font-size: 17px; font-weight: 700; color: var(--heading); }
.stage-card .stage-summary { font-size: 13px; color: var(--muted); }
.stage-card .stage-body { padding: 4px 16px 16px 62px; display: flex; flex-direction: column; gap: 12px; }
.people-rows { list-style: none; margin: 0; padding: 0; }
.people-rows li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.people-rows li:first-child { border-top: none; }
.people-rows .person { min-width: 180px; }
.people-rows .actions { margin-left: auto; }
.people-rows .wrap { flex-basis: 100%; }
.picker-inline .team-picker { max-width: 420px; }
.stage-card .fallback { margin-top: 4px; }
.tech-body .two-col { margin-bottom: 14px; }
.tech-body table { display: block; overflow-x: auto; margin-top: 6px; }
@media (max-width: 720px) { .stage-card > summary { grid-template-columns: 34px 1fr auto; } .stage-card .stage-summary { grid-column: 1 / -1; } .stage-card .stage-body { padding-left: 16px; } }

.turtle-card header .card-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

.inbox-sub { margin: 18px 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.done-list .history-row .what { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }

.history-row .when .waiting { color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; }
.history-row.waiting::before { background: var(--surface); border-color: var(--muted); }
.history-row .facts { margin-top: 4px; }

/* Cuadro de confirmación propio (sustituye al confirm del navegador), mismo estilo que los avisos del etiquetador. */
dialog.tortuid-confirm { border: none; padding: 0; background: transparent; max-width: 460px; width: calc(100% - 32px); }
dialog.tortuid-confirm::backdrop { background: rgba(10, 30, 34, 0.55); }
dialog.tortuid-confirm .box { background: var(--surface); color: var(--text); border-radius: 8px; padding: 24px 28px; box-shadow: 0 18px 50px rgba(0,0,0,0.35); animation: celebration-pop 0.25s ease-out; }
dialog.tortuid-confirm h3 { margin: 0 0 8px; color: var(--heading); }
dialog.tortuid-confirm p { margin: 0 0 18px; font-size: 14px; line-height: 1.5; }
dialog.tortuid-confirm .row { display: flex; justify-content: flex-end; gap: 10px; }
