/* «Para leer» — bandeja de lecturas de Matías. Estilo apple-design (tokens de la app del estudio):
   fondo gris con grupos blancos redondeados (Recordatorios / Ajustes del iPhone). */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-titulo: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --texto: #1d1d1f; --texto-2: #6e6e73; --texto-3: #86868b;
  --fondo: #f5f5f7; --panel: #ffffff;
  --relleno: rgb(120 120 128 / .12); --relleno-2: rgb(120 120 128 / .20);
  --sep: #e5e5ea; --borde: #d2d2d7;
  --acento: #0071e3; --acento-hover: #0077ed; --acento-activo: #006edb;
  --rojo: #ff3b30; --rojo-texto: #d70015;
  --naranja: #ff9500; --naranja-texto: #c93400;
  --amarillo: #ffcc00; --amarillo-texto: #b25000;
  --verde: #34c759; --verde-texto: #248a3d;
  --gris: #8e8e93;
  --barra: rgb(245 245 247 / .8);
  --pill: #ffffff;
  --cuerpo: 13px; --cuerpo-lh: 18px;
  --secundario: 12px; --secundario-lh: 16px;
  --toque: 28px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --margen: 20px;
}
@media (max-width: 767px) {
  :root { --cuerpo: 15px; --cuerpo-lh: 20px; --secundario: 13px; --secundario-lh: 18px; --toque: 44px; --margen: 16px; }
}
@media (prefers-color-scheme: dark) {
  :root {
    --texto: #f5f5f7; --texto-2: #a1a1a6; --texto-3: #6e6e73;
    --fondo: #000000; --panel: #1c1c1e;
    --relleno: rgb(118 118 128 / .24); --relleno-2: rgb(118 118 128 / .32);
    --sep: #38383a; --borde: #48484a;
    --acento: #0a84ff; --acento-hover: #409cff; --acento-activo: #0071e3;
    --rojo: #ff453a; --rojo-texto: #ff6961;
    --naranja: #ff9f0a; --naranja-texto: #ffb340;
    --amarillo: #ffd60a; --amarillo-texto: #ffd426;
    --verde: #30d158; --verde-texto: #30db5b;
    --barra: rgb(0 0 0 / .72);
    --pill: #636366;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fondo); color: var(--texto);
  font: 400 var(--cuerpo)/var(--cuerpo-lh) var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
svg { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
:focus { outline: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--acento) 45%, transparent); outline-offset: 2px; }

/* Barra superior: marca del estudio (lo único translúcido) */
.barra {
  position: sticky; top: 0; z-index: 5;
  background: var(--barra);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid transparent;
  padding-top: env(safe-area-inset-top);
  transition: border-color .2s var(--ease);
}
.barra.con-linea { border-bottom-color: var(--sep); }
.barra-in { max-width: 760px; margin: 0 auto; padding: 8px var(--margen); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.marca { display: flex; align-items: center; gap: 10px; min-width: 0; }
.marca picture { display: block; min-width: 0; }
.mono { display: block; width: 36px; height: auto; }
.logo-texto { display: block; height: 32px; width: auto; max-width: 100%; }
.icono-btn {
  width: var(--toque); height: var(--toque); display: grid; place-items: center; flex: none;
  border: 0; border-radius: 999px; background: transparent; color: var(--acento);
}
.icono-btn:hover { background: var(--relleno); }
.icono-btn svg { width: 20px; height: 20px; }
.icono-btn.girando svg { animation: girar .8s var(--ease) infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

.contenido { max-width: 760px; margin: 0 auto; padding: 0 var(--margen) calc(48px + env(safe-area-inset-bottom)); }

/* Título grande */
.cabeza { padding: 14px 0 4px; }
.titulo { margin: 0; font: 700 34px/41px var(--font-titulo); letter-spacing: -.02em; }
.subtitulo { margin: 2px 0 14px; font-size: var(--secundario); line-height: var(--secundario-lh); color: var(--texto-2); font-variant-numeric: tabular-nums; }

/* Control segmentado: de quién es */
.segmentado { display: flex; padding: 2px; border-radius: 9px; background: var(--relleno); }
.segmentado button {
  flex: 1; min-width: 0; height: 32px; padding: 0 6px; border: 0; border-radius: 7px;
  background: transparent; font-size: var(--secundario); color: var(--texto); white-space: nowrap;
  transition: background .15s var(--ease);
}
.segmentado button[aria-selected="true"] {
  background: var(--pill); font-weight: 600;
  box-shadow: 0 1px 2px rgb(0 0 0 / .12), 0 0 0 .5px rgb(0 0 0 / .06);
}
.segmentado .n { margin-left: 4px; color: var(--texto-3); font-weight: 400; font-variant-numeric: tabular-nums; }
.segmentado button[aria-selected="true"] .n { color: var(--texto-2); }

/* Equipo: una pastilla por persona */
.personas { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.personas::-webkit-scrollbar { display: none; }
.personas[hidden] { display: none; }
.persona-btn {
  flex: none; height: 30px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px;
  border: 0; border-radius: 999px; background: var(--relleno); color: var(--texto);
  font-size: var(--secundario); font-weight: 500; white-space: nowrap;
}
.persona-btn .n { color: var(--texto-3); font-variant-numeric: tabular-nums; }
.persona-btn[aria-pressed="true"] { background: var(--acento); color: #fff; font-weight: 600; }
.persona-btn[aria-pressed="true"] .n { color: rgb(255 255 255 / .8); }

/* Tarjetas de resumen (Recordatorios) */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 0 14px; }

.tile {
  position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 8px 8px;
  padding: 10px 12px 10px 10px; border: 0; border-radius: 12px; background: var(--panel); text-align: left;
  box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .15s var(--ease), transform .15s var(--ease);
}
.tile:active { transform: scale(.98); }
.tile[aria-pressed="true"] { background: color-mix(in srgb, var(--acento) 10%, var(--panel)); box-shadow: inset 0 0 0 2px var(--acento); }
.tile-ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.tile-ic svg { width: 17px; height: 17px; stroke-width: 2; }
.tile-ic.rojo { background: var(--rojo); }
.tile-ic.naranja { background: var(--naranja); }
.tile-ic.amarillo { background: var(--amarillo); color: #1d1d1f; }
.tile-ic.gris { background: var(--gris); }
.tile-ic.verde { background: var(--verde); }
.tile-ancha { grid-column: 1 / -1; }
@media (min-width: 768px) { .tiles { grid-template-columns: repeat(5, 1fr); } .tile-ancha { grid-column: auto; } .tile-ancha .tile-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } }
.tile-n { justify-self: end; font: 700 26px/30px var(--font-titulo); font-variant-numeric: tabular-nums; }
.tile-t { grid-column: 1 / -1; font-size: var(--secundario); line-height: var(--secundario-lh); font-weight: 600; color: var(--texto-2); }

/* Buscador + fecha */
.busca-fila { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.fecha-ctl {
  position: relative; flex: none; height: 36px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px;
  border-radius: 10px; background: var(--relleno); color: var(--texto); font-size: var(--secundario); font-weight: 500; cursor: pointer;
}
.fecha-ctl svg { width: 17px; height: 17px; color: var(--acento); }
.fecha-ctl.con-fecha { background: color-mix(in srgb, var(--acento) 14%, transparent); color: var(--acento); font-weight: 600; }
.fecha-ctl input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; cursor: pointer; -webkit-appearance: none; appearance: none; }
.fecha-x { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 999px; background: var(--relleno); color: var(--texto-2); }
.fecha-x svg { width: 16px; height: 16px; }
.fecha-x[hidden] { display: none; }
.buscador {
  flex: 1; min-width: 0;
  height: 36px; padding: 0 10px;
  display: flex; align-items: center; gap: 6px; border-radius: 10px;
  background: var(--relleno); color: var(--texto-2);
}
.buscador:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--acento) 30%, transparent); }
.buscador svg { width: 17px; height: 17px; flex: none; }
.buscador input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: var(--cuerpo); color: var(--texto); }
.buscador input::placeholder { color: var(--texto-2); }
.buscador input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* Grupos (Ajustes): encabezado afuera, filas adentro con separador desde el texto */
.grupo-t {
  margin: 22px 4px 7px; display: flex; justify-content: space-between; align-items: baseline;
  font-size: var(--secundario); line-height: var(--secundario-lh); font-weight: 600; color: var(--texto-2);
}
.grupo-t .n { font-weight: 400; color: var(--texto-3); font-variant-numeric: tabular-nums; }
.grupo { background: var(--panel); border-radius: 12px; overflow: hidden; }

.fila {
  position: relative; display: grid; grid-template-columns: 10px 1fr auto; gap: 0 12px; align-items: start;
  padding: 0 4px 0 14px;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.fila + .fila::before { content: ""; position: absolute; top: 0; left: 36px; right: 0; height: .5px; background: var(--sep); }
@media (max-width: 767px) { .fila + .fila::before { height: 1px; transform: scaleY(.5); transform-origin: top; } }
.fila.saliendo { opacity: 0; transform: translateX(-24px); }
.punto { width: 10px; height: 10px; border-radius: 50%; margin-top: 17px; background: transparent; box-shadow: inset 0 0 0 1.5px var(--sep); }
.punto.rojo { background: var(--rojo); box-shadow: none; }
.punto.naranja { background: var(--naranja); box-shadow: none; }
.fila-link { display: block; min-width: 0; padding: 11px 0 12px; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.fila-link:active { opacity: .55; }
.l1 { display: flex; align-items: baseline; gap: 8px; }
.nombre { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fecha { flex: none; font-size: var(--secundario); color: var(--texto-3); font-variant-numeric: tabular-nums; }
.fecha.rojo { color: var(--rojo-texto); font-weight: 600; }
.detalle {
  margin-top: 2px; font-size: var(--secundario); line-height: var(--secundario-lh); color: var(--texto);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.meta { margin-top: 5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: var(--secundario); line-height: var(--secundario-lh); color: var(--texto-2); }
.badge {
  height: 20px; padding: 0 8px; display: inline-flex; align-items: center; border-radius: 999px;
  font-size: 11px; line-height: 14px; font-weight: 600;
}
.badge.firma { background: color-mix(in srgb, var(--amarillo) 24%, transparent); color: var(--amarillo-texto); }
.badge.decision { background: color-mix(in srgb, var(--naranja) 16%, transparent); color: var(--naranja-texto); }
.badge.quien { background: var(--relleno); color: var(--texto-2); }
.badge.persona { background: color-mix(in srgb, var(--acento) 12%, transparent); color: var(--acento); }
.nota {
  margin-top: 3px; font-size: var(--secundario); line-height: var(--secundario-lh); color: var(--texto-2); font-style: italic;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
/* «Seguir en Claude»: debajo de la fila, alineado con el texto */
.acciones { grid-column: 2 / -1; margin-top: -4px; padding-bottom: 11px; display: flex; gap: 8px; }
.seguir {
  height: 28px; padding: 0 11px 0 9px; display: inline-flex; align-items: center; gap: 6px;
  border: 0; border-radius: 999px; background: var(--relleno); color: var(--acento);
  font-size: 12px; line-height: 16px; font-weight: 600; white-space: nowrap;
}
.seguir:hover { background: var(--relleno-2); }
/* «Subir»: la orden al Presentador */
.acciones { flex-wrap: wrap; align-items: center; }
.subir {
  height: 28px; padding: 0 11px 0 9px; display: inline-flex; align-items: center; gap: 6px;
  border: 0; border-radius: 999px; background: var(--relleno); color: var(--texto);
  font-size: 12px; line-height: 16px; font-weight: 600; white-space: nowrap;
}
.subir:hover { background: var(--relleno-2); }
.subir:active { opacity: .6; }
.subir svg { width: 14px; height: 14px; stroke-width: 2; }
.subir.fuerte { background: var(--acento); color: #fff; padding: 0 12px; }
.subir.directo { background: color-mix(in srgb, var(--naranja) 18%, transparent); color: var(--naranja-texto); padding: 0 12px; }
.sub-estado { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--texto-2); }
.sub-estado.subido { color: var(--verde-texto); }
.sub-estado.subiendo { color: var(--acento); }
.sub-estado.duda { color: var(--naranja-texto); }
.sub-estado.mal { color: var(--rojo-texto); }
.seguir:active { opacity: .6; }
.seguir svg { width: 14px; height: 14px; stroke-width: 2; }
@media (max-width: 767px) { .subir { height: 32px; font-size: 13px; } .sub-estado { font-size: 13px; } .seguir { height: 32px; font-size: 13px; } .segmentado button { padding: 0 2px; } .segmentado .n { margin-left: 3px; } }
.badge.presentado { background: color-mix(in srgb, var(--verde) 16%, transparent); color: var(--verde-texto); }
.badge.leido, .badge.salio { background: var(--relleno); color: var(--texto-2); }
.punto.verde { background: var(--verde); box-shadow: none; }
.punto.gris { background: var(--gris); box-shadow: none; }
.fila.vista .nombre { font-weight: 500; }
.abierto { color: var(--texto-3); }
.volver {
  height: 30px; margin-top: 10px; padding: 0 10px; border: 0; border-radius: 999px; white-space: nowrap;
  background: color-mix(in srgb, var(--acento) 12%, transparent); color: var(--acento); font-size: 12px; font-weight: 600;
}
.listo {
  width: var(--toque); height: var(--toque); min-width: 36px; min-height: 36px; margin-top: 4px;
  display: grid; place-items: center; border: 0; border-radius: 999px; background: transparent; color: var(--texto-3);
}
.listo:hover { color: var(--verde-texto); background: var(--relleno); }
.listo svg { width: 22px; height: 22px; }

/* Estados */
.vacio { padding: 48px 16px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.vacio svg { width: 30px; height: 30px; color: var(--verde); margin-bottom: 8px; stroke-width: 2; }
.vacio p { margin: 0; }
.vacio .t { font-size: 15px; line-height: 20px; font-weight: 600; }
.vacio .s { font-size: var(--secundario); line-height: var(--secundario-lh); color: var(--texto-2); }
.esqueleto { height: 70px; padding: 0 16px; display: flex; align-items: center; }
.esqueleto + .esqueleto { border-top: .5px solid var(--sep); }
.esqueleto div { height: 10px; width: 45%; border-radius: 999px; background: var(--relleno); animation: latir 1.2s ease-in-out infinite; }
@keyframes latir { 50% { opacity: .45; } }

.pie { margin: 26px 4px 0; text-align: center; font-size: 11px; line-height: 14px; color: var(--texto-3); }

/* Aviso flotante con «Deshacer» */
.aviso {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 10; display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px);
  padding: 10px 10px 10px 16px; border-radius: 14px; background: var(--panel); color: var(--texto);
  box-shadow: 0 0 0 .5px rgb(0 0 0 / .12), 0 8px 28px rgb(0 0 0 / .16);
  font-size: var(--secundario);
}
.aviso[hidden] { display: none; }
.aviso button { border: 0; background: transparent; color: var(--acento); font-weight: 600; min-height: 32px; padding: 0 6px; border-radius: 6px; }

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

/* Dentro de la app (solapa «Para leer»): sin el logo, que ya está en la cabecera de la app */
.embebida .marca { display: none; }
.embebida .barra-in { justify-content: flex-end; padding-top: 4px; padding-bottom: 0; }

/* «Seguir conversación»: el texto trae la conversación original donde se hizo el escrito */
.seguir.con-conv { background: color-mix(in srgb, var(--acento) 14%, transparent); font-weight: 600; }
.seguir.con-conv:hover { background: color-mix(in srgb, var(--acento) 22%, transparent); }

/* Orden de la lista (vencimiento / fecha) */
.busca-fila { flex-wrap: wrap; }
.buscador { flex: 1 1 180px; }
.orden-ctl {
  flex: none; height: 36px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; border: 0;
  border-radius: 10px; background: var(--relleno); color: var(--texto); font: inherit; font-size: var(--secundario); font-weight: 500; cursor: pointer;
}
.orden-ctl svg { width: 17px; height: 17px; color: var(--acento); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.orden-ctl[aria-pressed="true"] { background: color-mix(in srgb, var(--acento) 14%, transparent); color: var(--acento); font-weight: 600; }
.orden-ctl[hidden] { display: none; }

/* Incrustada en la app: el calendario lo abre el propio campo (el botón de calendario del campo ocupa todo el control) */
.embebida .fecha-ctl input { -webkit-appearance: auto; appearance: auto; }
.embebida .fecha-ctl input::-webkit-calendar-picker-indicator {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer;
}

/* Renglón fijo debajo del nombre: cuándo se hizo y, si se presentó, cuándo */
.tiempos { margin-top: 1px; font-size: var(--secundario); line-height: var(--secundario-lh); color: var(--texto-2); font-variant-numeric: tabular-nums; }
.tiempos b { font-weight: 600; color: var(--texto); }
.tiempos .sep { margin: 0 6px; color: var(--texto-3); }

/* Desplegables de filtro (jurisdicción · tema): misma forma que los otros controles de la fila */
.filtro-sel {
  flex: none; height: 36px; max-width: 100%; padding: 0 30px 0 12px; border: 0; border-radius: 10px;
  background-color: var(--relleno); color: var(--texto); font: inherit; font-size: var(--secundario); font-weight: 500; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 15px;
}
.filtro-sel.con-filtro { background-color: color-mix(in srgb, var(--acento) 14%, transparent); color: var(--acento); font-weight: 600; }

/* Pestañas: cada una ocupa lo que pide su nombre («Empleados IA» es más largo que «Yo») y ninguna se pisa con la de al lado */
.segmentado button { flex: 1 1 auto; white-space: nowrap; }

/* Tarjetas: Todo · Vencido u hoy · Próximos 7 días · Sin fecha · Falta firmar · Listos (6: tres filas de dos en el teléfono, una fila en la compu) */
.tile-t-largo { display: none; }
@media (min-width: 768px) {
  .tiles { grid-template-columns: repeat(6, 1fr); }
  .tile-ancha .tile-t, .tile-t { white-space: normal; overflow: visible; }
}
@media (min-width: 1100px) { .tile-t-largo { display: inline; } }
