:root {
  --papel: #E9EDF1; --hoja: #FFFFFF; --cinta: #F7F8FA; --tinta: #1C2B3A; --tinta-2: #5B6B7B; --regla: #D3DBE3;
  --accion: #3346B8; --accion-suave: #E3E7FA; --urgente: #C2255C; --urgente-suave: #FCE4EC;
  --pendiente: #B07800; --pendiente-suave: #FFF4D6; --terminado: #2B8A7E; --terminado-suave: #DDF3EF;
  --sombra: 0 1px 3px rgba(28,43,58,.12), 0 4px 18px rgba(28,43,58,.06);
  --doc: "Times New Roman", "Tinos", Times, serif; --ui: "Archivo", system-ui, sans-serif; --mono: "JetBrains Mono", monospace;
  color-scheme: light;
}
/* El marco (barra, lista, fondo) sigue al sistema; los temas solo cambian las hojas de texto. */
@media (prefers-color-scheme: dark) { :root {
  --papel: #12181F; --hoja: #1B232C; --cinta: #161D25; --tinta: #E6ECF2; --tinta-2: #9AA9B8; --regla: #2C3742;
  --accion: #8C9BFF; --accion-suave: #252C52; --urgente: #FF6B9A; --urgente-suave: #3A1A27;
  --pendiente: #F2B53A; --pendiente-suave: #3A2E12; --terminado: #4FD1BE; --terminado-suave: #12322E;
  --sombra: 0 1px 3px rgba(0,0,0,.4); color-scheme: dark; } }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--papel); color: var(--tinta); font-family: var(--ui); font-size: 15px; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; fill: currentColor; }

/* ---- entrar ---- */
.entrar { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.entrar-caja { background: var(--hoja); padding: 40px 36px; border-radius: 10px; box-shadow: var(--sombra); text-align: center; max-width: 360px; width: 100%; }
.entrar-caja .marca { width: 64px; height: 64px; fill: none; }
.entrar-caja h1 { font-variation-settings: "wdth" 80; font-size: 34px; margin: 8px 0 4px; }
.entrar-caja p { color: var(--tinta-2); }
.btn-principal { background: var(--accion); color: #fff; border: 0; padding: 12px 22px; border-radius: 8px; font-weight: 600; }
.aviso { color: var(--urgente); min-height: 1.2em; font-size: 13px; }

/* ---- cinta (barra tipo Word) ---- */
#app { display: flex; flex-direction: column; height: 100%; }
.cinta { background: var(--cinta); border-bottom: 1px solid var(--regla); position: sticky; top: 0; z-index: 20; }
.cinta-fila1 { display: flex; align-items: center; gap: 10px; padding: 8px 16px 2px; }
.titulo { font-size: 17px; margin: 0; font-weight: 700; font-variation-settings: "wdth" 85; letter-spacing: .2px; }
.temas { margin-left: auto; display: flex; gap: 2px; padding: 2px; border: 1px solid var(--regla); border-radius: 8px; background: var(--hoja); }
.temas button { width: 28px; height: 24px; border: 0; background: none; border-radius: 6px; display: grid; place-items: center; color: var(--tinta-2); padding: 0; }
.temas button svg { width: 16px; height: 16px; }
.temas button:hover { color: var(--tinta); }
.temas button.on { background: var(--accion-suave); color: var(--accion); }
.guardado { margin-left: 10px; font-size: 12px; color: var(--tinta-2); font-family: var(--mono); }
.guardado::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--terminado); margin-right: 6px; vertical-align: 1px; }
.guardado.activo::before { background: var(--pendiente); }
.btn-avisos { margin-left: 8px; width: 28px; height: 26px; border: 1px solid var(--regla); border-radius: 8px; background: var(--hoja); color: var(--tinta-2); display: grid; place-items: center; padding: 0; }
.btn-avisos svg { width: 16px; height: 16px; }
.btn-avisos .onda { opacity: 0; }
.btn-avisos.on { background: var(--accion-suave); color: var(--accion); border-color: transparent; }
.btn-avisos.on .onda { opacity: 1; }
.aviso-sistema { margin-left: 10px; font-size: 12px; font-weight: 700; color: #fff; background: var(--urgente, #C2255C); border-radius: 999px; padding: 2px 9px; cursor: help; white-space: nowrap; }
.herramientas { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px 12px 8px; }
.grupo { display: flex; align-items: center; gap: 1px; padding: 0 6px; border-right: 1px solid var(--regla); }
.grupo:last-child { border-right: 0; }
.h-btn { background: none; border: 1px solid transparent; border-radius: 5px; height: 32px; min-width: 32px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.h-btn:hover { background: var(--accion-suave); }
.h-btn.on { background: var(--accion-suave); border-color: var(--accion); }
.h-btn.letra { font-family: var(--doc); font-size: 17px; }
.h-btn.txt span { font-size: 13px; font-weight: 600; }
.h-btn:focus-visible, .h-flecha:focus-visible, .t-chip:focus-visible { outline: 2px solid var(--accion); outline-offset: 1px; }
.h-sel { height: 32px; border: 1px solid var(--regla); border-radius: 5px; background: var(--hoja); color: var(--tinta); padding: 0 8px; font: inherit; font-size: 14px; min-width: 110px; }
.h-sel.tamano { min-width: 74px; margin-left: 6px; }
.desplegable { position: relative; display: flex; }
.h-flecha { background: none; border: 0; width: 16px; height: 32px; font-size: 10px; border-radius: 4px; color: var(--tinta-2); padding: 0; }
.h-flecha:hover { background: var(--accion-suave); }
.paleta { position: absolute; top: 36px; left: 0; background: var(--hoja); border: 1px solid var(--regla); border-radius: 8px; box-shadow: var(--sombra); padding: 8px; display: grid; grid-template-columns: repeat(3, 28px); gap: 6px; z-index: 30; }
.paleta button { width: 28px; height: 28px; border-radius: 5px; border: 1px solid rgba(0,0,0,.15); background: var(--c); }
.paleta .sin { background: var(--hoja); font-size: 12px; color: var(--tinta-2); }
.tareas-grupo .h-btn[data-cmd="hecho"], .tareas-grupo .h-btn[data-cmd="urgente"], .tareas-grupo .h-btn[data-cmd="fecha"] { opacity: .55; }
.tareas-grupo.en-tarea .h-btn { opacity: 1; }
#btnDictar.escuchando, .burbuja button.escuchando { background: var(--urgente) !important; color: #fff !important; }
#btnDictar.escuchando svg { animation: latido 1s infinite; }
@keyframes latido { 50% { transform: scale(1.18); } }
.solo-movil { display: none; }
.h-btn.b-borrar { color: #E5484D; }
.h-btn.b-borrar:hover { background: rgba(229,72,77,.12); }

/* ---- cuerpo ---- */
.cuerpo { flex: 1; display: grid; grid-template-columns: 260px 1fr; min-height: 0; }
.lateral { border-right: 1px solid var(--regla); background: var(--cinta); padding: 14px 14px 30px; overflow-y: auto; }
.lat-cab { display: flex; align-items: center; justify-content: space-between; }
.lateral h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--tinta-2); margin: 0; }
.btn-pin { background: none; border: 0; width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; color: var(--tinta-2); margin-left: 4px; }
.btn-pin:hover { background: var(--accion-suave); color: var(--tinta); }
.btn-pin .pin-cuerpo { fill: none; }
.btn-pin.on { color: var(--accion); }
.btn-pin.on .pin-cuerpo { fill: currentColor; }
.btn-pin.on svg { transform: rotate(0); }
.btn-pin svg { transform: rotate(35deg); transition: transform .15s; }
.lat-cab h2 { flex: 1; }
.nav-ini { display: none; }
.btn-mini { background: var(--accion); color: #fff; border: 0; border-radius: 6px; padding: 5px 10px; font-size: 13px; font-weight: 600; }
.lat-acciones { margin: 10px 0 6px; font-size: 13px; color: var(--tinta-2); }
.btn-enlace { background: none; border: 0; padding: 0; color: var(--accion); font-size: 13px; }
.lat-filtro { display: flex; gap: 6px; align-items: center; font-size: 13px; margin-bottom: 10px; }
.nav { list-style: none; padding: 0; margin: 0; }
.nav li { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.nav li:hover { background: var(--accion-suave); }
.agarre { display: grid; place-items: center; width: 14px; height: 22px; margin-left: -4px; color: var(--tinta-2); opacity: 0; cursor: grab; touch-action: none; flex: none; }
.agarre svg { width: 8px; height: 13px; }
.nav li:hover .agarre { opacity: .8; }
.nav.ordenando, .nav.ordenando li { cursor: grabbing; user-select: none; }
.nav li.arrastrando { background: var(--hoja); box-shadow: var(--sombra); outline: 2px solid var(--accion); }
.nav li.arrastrando .agarre { opacity: 1; }
.nav li.plegado .nav-nombre { color: var(--tinta-2); }
.nav li.activo { background: var(--accion-suave); box-shadow: inset 3px 0 0 var(--accion); font-size: 16px; font-weight: 700; padding-top: 9px; padding-bottom: 9px; }
.nav li.activo .nav-nombre { color: var(--tinta); }
.nav-archivar { display: none; flex: none; width: 24px; height: 24px; border: 0; background: none; border-radius: 5px; color: var(--tinta-2); place-items: center; padding: 0; }
.nav-archivar svg { width: 15px; height: 15px; }
.nav li:hover .nav-archivar { display: inline-grid; }
.nav li:hover .nav-u, .nav li:hover .nav-p { display: none; }
.nav-archivar:hover { background: var(--accion-suave); color: var(--accion); }
.archivados { margin-top: 14px; border-top: 1px solid var(--regla); padding-top: 8px; }
.archivados summary { cursor: pointer; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--tinta-2); list-style: none; padding: 4px 2px; }
.archivados summary::-webkit-details-marker { display: none; }
.archivados summary::before { content: "▸ "; }
.archivados[open] summary::before { content: "▾ "; }
.arch-cuenta { font-family: var(--mono); font-size: 11px; }
.nav-arch li { color: var(--tinta-2); font-size: 13px; }
.arch-restaurar { display: none; border: 0; background: var(--accion-suave); color: var(--accion); border-radius: 5px; font: 600 11px var(--ui); padding: 3px 7px; }
.nav-arch li:hover .arch-restaurar { display: inline-block; }
.nav-nombre { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* grupos de proyectos: encabezado mínimo y una llave fina a la izquierda que abraza a los suyos */
.nav li.ng-cab { margin-top: 8px; padding: 3px 4px 3px 1px; gap: 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .9px; text-transform: uppercase; color: var(--tinta-2); }
.nav li.ng-cab:hover { background: none; color: var(--tinta); }
.ng-flecha { display: grid; place-items: center; width: 12px; flex: none; color: var(--llave); }
.ng-flecha svg { width: 10px; height: 10px; transition: transform .12s; }
.ng-cab.plegado .ng-flecha svg { transform: rotate(-90deg); }
.ng-nombre { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ng-n { font-family: var(--mono); font-weight: 400; letter-spacing: 0; opacity: .7; }
.ng-ini { display: none; }
.ng-mas { flex: none; width: 20px; height: 18px; border: 0; background: none; border-radius: 4px; color: var(--tinta-2); display: grid; place-items: center; padding: 0; opacity: 0; }
.ng-mas svg { width: 12px; height: 12px; fill: currentColor; }
.ng-cab:hover .ng-mas { opacity: 1; }
.ng-mas:hover { background: var(--accion-suave); color: var(--accion); }
.nav { --llave: color-mix(in srgb, var(--accion) 55%, transparent); }
.nav li.en-grupo { position: relative; margin-left: 12px; }
.nav li.en-grupo::before { content: ""; position: absolute; left: -6px; top: 0; bottom: 0; width: 2px; background: var(--llave); border-radius: 0; }
.nav li.en-grupo.g-fin::before { bottom: 5px; border-bottom-left-radius: 2px; }
.nav li.en-grupo.g-fin::after { content: ""; position: absolute; left: -6px; bottom: 5px; width: 7px; height: 2px; background: var(--llave); border-radius: 0 2px 2px 0; }
.hoja { position: relative; }
.senal { position: absolute; z-index: 5; pointer-events: none; border-radius: 8px; border: 2px solid var(--accion); background: color-mix(in srgb, var(--accion) 22%, transparent); animation: senalar 3.5s ease-out forwards; }
@keyframes senalar { 0%, 15% { opacity: 1; transform: scale(1.015); } 30%, 60% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.menu-flotante { position: fixed; right: auto; z-index: 60; max-width: 260px; max-height: 70vh; overflow-y: auto; }
.menu-flotante .actual { font-weight: 700; color: var(--accion); }
.nav-u, .nav-p { font-family: var(--mono); font-size: 11px; border-radius: 10px; padding: 1px 6px; }
.nav-u { background: var(--urgente-suave); color: var(--urgente); font-weight: 600; }
.nav-p { background: var(--pendiente-suave); color: var(--pendiente); }
.proximo { margin-top: 22px; }
.proximo ol { list-style: none; padding: 0; margin: 8px 0 0; }
.proximo li { padding: 7px 8px; border-left: 3px solid var(--pendiente); background: var(--hoja); margin-bottom: 6px; border-radius: 0 6px 6px 0; font-size: 13px; cursor: pointer; }
.proximo li.urgente { border-left-color: var(--urgente); }
.proximo .cuando { display: block; font-family: var(--mono); font-size: 11px; color: var(--tinta-2); }

.hojas { overflow: auto; padding: 26px 24px 120px; }
/* hoja de ancho fijo como en Word: al acercar se agranda (desplazamiento horizontal) sin reacomodar el texto */
@media (min-width: 821px) { .hojas { display: grid; justify-content: safe center; align-content: start; } .hojas > .hoja { margin-left: 0; margin-right: 0; } }
.vacio { text-align: center; color: var(--tinta-2); padding: 60px 16px; }

/* ---- lista compacta: solo iniciales; se abre encima al pasar el mouse ---- */
@media (min-width: 821px) {
  body.lat-compacta .cuerpo { grid-template-columns: 64px 1fr; position: relative; }
  body.lat-compacta .hojas { grid-column: 2; }
  body.lat-compacta .lateral { position: absolute; top: 0; bottom: 0; left: 0; width: 64px; z-index: 30; padding: 14px 8px 30px; overflow-x: hidden; transition: width .16s ease, box-shadow .16s; }
  body.lat-compacta .lateral:hover { width: 270px; padding: 14px 14px 30px; box-shadow: 6px 0 24px rgba(0,0,0,.25); transition-delay: .12s; }
  body.lat-compacta .lateral:not(:hover) .btn-archivo { justify-content: center; padding: 7px 0; position: relative; }
  body.lat-compacta .lateral:not(:hover) .btn-archivo span:not(.cuenta-archivo) { display: none; }
  body.lat-compacta .lateral:not(:hover) .cuenta-archivo { position: absolute; top: -6px; right: -2px; margin: 0; background: var(--accion); color: #fff; border-radius: 8px; padding: 0 4px; font-size: 9px; }
  body.lat-compacta .lateral:not(:hover) .cuenta-archivo:empty { display: none; }
  body.lat-compacta .lateral:not(:hover) .archivados { display: none; }
  body.lat-compacta .lateral:not(:hover) :is(.lat-cab h2, .txt-nuevo, .lat-acciones, .lat-filtro, .proximo, .nav-nombre, .agarre) { display: none; }
  body.lat-compacta .lateral:not(:hover) .lat-cab { flex-direction: column; gap: 8px; }
  body.lat-compacta .lateral:not(:hover) .btn-pin { margin: 0; }
  body.lat-compacta .lateral:not(:hover) .nav { margin-top: 12px; }
  body.lat-compacta .lateral:not(:hover) .nav li { flex-direction: column; gap: 2px; padding: 6px 0; justify-content: center; }
  body.lat-compacta .lateral:not(:hover) .nav-ini { display: grid; place-items: center; width: 36px; height: 30px; border-radius: 7px; background: var(--hoja); font-weight: 700; font-size: 13px; letter-spacing: .5px; }
  body.lat-compacta .lateral:not(:hover) .nav li.activo { font-size: inherit; box-shadow: none; background: none; }
  body.lat-compacta .lateral:not(:hover) .nav li.activo .nav-ini { background: var(--accion); color: #fff; }
  body.lat-compacta .lateral:not(:hover) .nav-u, body.lat-compacta .lateral:not(:hover) .nav-p { font-size: 10px; padding: 0 5px; }
  body.lat-compacta .lateral:not(:hover) .nav li { display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; column-gap: 2px; row-gap: 2px; }
  body.lat-compacta .lateral:not(:hover) .nav li .nav-ini { margin: 0 calc(50% - 18px); }
  body.lat-compacta .lateral:not(:hover) .nav-u, body.lat-compacta .lateral:not(:hover) .nav-p { padding: 0 3px; font-size: 9.5px; line-height: 14px; }
  /* lista compacta: del grupo solo sus iniciales, y la llave pegada al borde */
  body.lat-compacta .lateral:not(:hover) :is(.ng-nombre, .ng-n, .ng-mas, .ng-flecha) { display: none; }
  body.lat-compacta .lateral:not(:hover) .nav li.ng-cab { margin-top: 8px; padding: 2px 0 1px; border-top: 1px solid var(--llave); border-radius: 0; }
  body.lat-compacta .lateral:not(:hover) .ng-ini { display: block; width: 100%; text-align: center; font-size: 9px; letter-spacing: .6px; }
  body.lat-compacta .lateral:not(:hover) .nav li.en-grupo { margin-left: 0; }
  body.lat-compacta .lateral:not(:hover) .nav li.en-grupo::before { left: 0; }
  body.lat-compacta .lateral:not(:hover) .nav li.en-grupo.g-fin::after { left: 0; }
}

/* ---- hoja (proyecto) ---- */
/* La hoja siempre es papel blanco, como en Word, aunque el resto esté en modo oscuro. */
.hoja { --hoja: #FFFFFF; --papel: #EEF1F4; --tinta: #1C2B3A; --tinta-2: #5B6B7B; --regla: #D3DBE3;
  --accion: #3346B8; --accion-suave: #E3E7FA; --urgente: #C2255C; --urgente-suave: #FCE4EC;
  --pendiente: #B07800; --pendiente-suave: #FFF4D6; --terminado: #2B8A7E; --terminado-suave: #DDF3EF;
  --t-amarillo: #FFF5C4; --t-amarillo-2: #FFEFA6; --t-chip-am: #FFE27A; --t-chip-am-txt: #6B4E00; --t-caja-am: #E0A800;
  --t-verde: #D7F5E1; --t-verde-2: #C6F0D4; --t-chip-vd: #2E9E5B; --t-caja-vd: #2E9E5B; --mark-txt: inherit;
  color: var(--tinta); color-scheme: light; }
:root[data-tema="oscuro"] .hoja { --hoja: #1D242D; --papel: #26303B; --tinta: #DCE3EA; --tinta-2: #93A2B2; --regla: #33404D;
  --accion: #8C9BFF; --accion-suave: #2A3160; --urgente: #FF7DA6; --urgente-suave: #42202D;
  --pendiente: #F2B53A; --pendiente-suave: #3D3115; --terminado: #4FD1BE; --terminado-suave: #12322E;
  --t-amarillo: rgba(242,181,58,.14); --t-amarillo-2: rgba(242,181,58,.2); --t-chip-am: #F2B53A; --t-chip-am-txt: #2A1F00; --t-caja-am: #D9A12B;
  --t-verde: rgba(63,190,120,.15); --t-verde-2: rgba(63,190,120,.22); --t-chip-vd: #3FBE78; --t-caja-vd: #3FBE78; --mark-txt: #1C2B3A;
  color-scheme: dark; }
:root[data-tema="nocturno"] .hoja { position: relative; }
/* Descanso: como Night Shift de Apple — la misma hoja con un filtro cálido parejo que quita luz azul */
:root[data-tema="nocturno"] .hoja::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: #FFC98A; mix-blend-mode: multiply; opacity: .42; pointer-events: none; z-index: 4; }
:root[data-tema="oscuro"] .hoja mark { color: var(--mark-txt); }
.hoja { zoom: var(--zoom, 1); background: var(--hoja); width: 860px; max-width: none; margin: 0 auto 22px; box-shadow: var(--sombra); border-radius: 3px; scroll-margin-top: 16px; }
.hoja-cab { display: flex; align-items: center; gap: 8px; padding: 18px 28px 6px 18px; border-bottom: 1px solid transparent; }
.hoja.plegada .hoja-cab { padding-bottom: 18px; }
.plegar { background: none; border: 0; width: 28px; height: 28px; border-radius: 5px; display: grid; place-items: center; color: var(--tinta-2); flex: none; }
.plegar:hover { background: var(--accion-suave); }
.plegar svg { transition: transform .15s; }
.hoja.plegada .plegar svg { transform: rotate(-90deg); }
.hoja-titulo { font-family: var(--doc); font-size: 22px; font-weight: 700; margin: 0; cursor: pointer; flex: 1; min-width: 0; }
.hoja-titulo[contenteditable="true"] { cursor: text; outline: 2px solid var(--accion); outline-offset: 3px; border-radius: 2px; }
.hoja-cuenta { font-size: 12px; color: var(--tinta-2); white-space: nowrap; }
.hoja-cuenta .cu { color: var(--urgente); }
.hoja-cuenta .cpr { color: #8A6A00; }
.hoja-cuenta .crv { color: #2E7D4F; font-weight: 600; }
.hoja-mas { position: relative; }
.btn-claude { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 14px; border: 1px solid var(--regla); background: var(--hoja); color: var(--tinta-2); font: 600 12.5px var(--ui); flex: none; }
.btn-claude svg { width: 15px; height: 15px; color: #D97757; }
.btn-claude .chat-etq { font-weight: 500; color: var(--tinta-2); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-claude .chat-etq:not(:empty)::before { content: "· "; }
.btn-claude.sin-vincular .chat-etq { font-style: italic; }
.ec-lbl { display: grid; gap: 4px; margin-top: 10px; font-size: 12px; font-weight: 600; color: #5B6B7B; }
/* burbuja compacta: solo el ícono; al pasar el mouse se despliega con la etiqueta y el proyecto */
.chat-flotante { position: fixed; right: 18px; bottom: 60px; z-index: 26; display: flex; align-items: center; gap: 0; height: 44px; max-width: 44px; padding: 0 12px; border-radius: 22px; border: 0; background: #D97757; color: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.28); cursor: pointer; font-family: var(--ui); text-align: left; overflow: hidden; transition: max-width .18s ease, gap .18s ease, padding .18s ease; }
.chat-flotante svg { width: 20px; height: 20px; flex: none; }
.chat-flotante .cf-txt { display: grid; line-height: 1.15; min-width: 0; opacity: 0; transition: opacity .12s ease; white-space: nowrap; }
.chat-flotante:hover, .chat-flotante:focus-visible { max-width: 260px; gap: 8px; padding: 0 16px 0 12px; }
.chat-flotante:hover .cf-txt, .chat-flotante:focus-visible .cf-txt { opacity: 1; transition-delay: .06s; }
.chat-flotante .cf-etq { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.chat-flotante .cf-proy { font-size: 11px; opacity: .85; overflow: hidden; text-overflow: ellipsis; }
.chat-flotante.sin-vincular { background: var(--cinta); color: var(--tinta); box-shadow: 0 0 0 1px var(--regla), 0 6px 18px rgba(0,0,0,.18); }
.chat-flotante.sin-vincular svg { color: #D97757; }
.btn-claude:hover { border-color: #D97757; color: var(--tinta); }
.enlace-claude { color-scheme: light; position: fixed; z-index: 66; top: 90px; left: 50%; transform: translateX(-50%); width: min(520px, calc(100% - 32px)); background: #fff; color: #1C2B3A; border-radius: 12px; box-shadow: 0 12px 36px rgba(15,25,45,.3); padding: 16px 18px; font-family: var(--ui); }
.enlace-claude h3 { margin: 0 0 6px; font-size: 15px; }
.enlace-claude p { margin: 0 0 10px; font-size: 12.5px; color: #5B6B7B; line-height: 1.45; }
.enlace-claude input { width: 100%; height: 36px; border: 1px solid #D3DBE3; border-radius: 7px; padding: 0 10px; font: 14px var(--ui); color: #1C2B3A; background: #fff; }
.enlace-claude input:focus { outline: 2px solid #3346B8; outline-offset: 0; border-color: #3346B8; }
.ec-acciones { display: flex; gap: 6px; align-items: center; margin-top: 12px; }
.ec-acciones span { flex: 1; }
.ec-sec { background: none; border: 0; color: #3346B8; font: 600 12.5px var(--ui); padding: 6px 4px; }
.ec-ok { background: #3346B8; color: #fff; border: 0; border-radius: 7px; padding: 7px 16px; font: 700 13px var(--ui); }
.btn-icono { background: none; border: 0; width: 30px; height: 30px; border-radius: 5px; display: grid; place-items: center; color: var(--tinta-2); }
.btn-icono:hover { background: var(--accion-suave); }
.mini-menu, .menu-flotante { position: absolute; right: 0; top: 34px; background: var(--hoja); border: 1px solid var(--regla); border-radius: 8px; box-shadow: var(--sombra); padding: 4px; min-width: 180px; z-index: 15; }
.mini-menu button, .menu-flotante button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 5px; font-size: 14px; }
.mini-menu button:hover, .menu-flotante button:hover { background: var(--accion-suave); }
.mini-menu .peligro, .menu-flotante .peligro { color: var(--urgente); }
.hoja.plegada .hoja-doc { display: none; }
.hoja-doc { padding: 4px 56px 40px; }

/* ---- documento ---- */
.ProseMirror { font-family: var(--doc); font-size: 12pt; line-height: 1.15; outline: none; min-height: 60px; }
.ProseMirror p { margin: 0; text-align: justify; }
.ProseMirror h1 { font-size: 22px; margin: 18px 0 6px; }
.ProseMirror h2 { font-size: 19px; margin: 16px 0 4px; }
.ProseMirror h3 { font-size: 17px; margin: 12px 0 4px; }
.ProseMirror ul, .ProseMirror ol { padding-left: 26px; margin: 2px 0 6px; }
.ProseMirror mark { border-radius: 0; padding: 0; color: inherit; }
.ProseMirror p.is-editor-empty:first-child::before { content: attr(data-placeholder); color: var(--tinta-2); float: left; height: 0; pointer-events: none; font-style: italic; }

/* tareas: casilla + estado + texto + fecha */
.ProseMirror ul[data-type="taskList"] { list-style: none; padding-left: 0; }
.ProseMirror ul[data-type="taskList"] ul[data-type="taskList"] { padding-left: 28px; }
li.tarea { -webkit-touch-callout: none; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; grid-template-areas: ". chip marca" "caja texto fecha"; column-gap: 8px; align-items: start; padding: 2px 6px 2px 4px; margin: 0 -6px 1px -4px; border-radius: 5px; border-left: 3px solid transparent; }
li.tarea:hover { background: var(--papel); }
li.tarea.urgente { border-left-color: var(--urgente); background: var(--urgente-suave); }
.t-controles { display: contents; user-select: none; }
.t-caja { grid-area: caja; margin-top: 4px !important; }
.t-contenido { grid-area: texto; }
.t-acciones { grid-area: fecha; align-self: center; display: flex; align-items: center; gap: 2px; }
.t-foto { flex: none; background: none; border: 1px dashed transparent; border-radius: 12px; width: 26px; height: 24px; display: inline-grid; place-items: center; color: var(--tinta-2); opacity: 0; cursor: pointer; padding: 0; }
.t-foto svg { width: 16px; height: 16px; }
.t-foto:hover { border-color: var(--regla); color: var(--accion); }
li.tarea:hover > .t-acciones .t-foto { opacity: 1; }
.foto-caja { position: relative; display: inline-block; vertical-align: top; margin: 6px 10px 6px 0; width: 320px; max-width: 100%; border-radius: 4px; background: var(--papel); min-height: 40px; outline: 2px solid transparent; outline-offset: 2px; box-shadow: 0 0 0 1px rgba(28,43,58,.22); }
.foto-caja.cargando { min-height: 120px; }
.foto-caja.error::after { content: "Foto no disponible"; display: block; padding: 20px; font: 12px var(--ui); color: var(--tinta-2); }
.foto-caja img.foto { display: block; width: 100%; height: auto; border-radius: 4px; cursor: pointer; user-select: none; }
:root[data-tema="oscuro"] .foto-caja { box-shadow: 0 0 0 1px rgba(255,255,255,.25); }
/* mismo tamaño elegido = mismo espacio: marco uniforme 4:3, imagen completa centrada (sin recortar) */
.foto-caja[data-tam="marco"] img.foto { aspect-ratio: 4 / 3; object-fit: contain; background: #fff; }
.foto-caja[data-tam="marco"].cargando { min-height: 0; aspect-ratio: 4 / 3; }
.foto-caja.sel { outline-color: var(--accion); }
.foto-asa { position: absolute; right: -6px; bottom: -6px; width: 14px; height: 14px; border-radius: 3px; background: var(--accion); border: 2px solid #fff; cursor: nwse-resize; display: none; touch-action: none; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.foto-barra { position: absolute; left: 0; top: -40px; display: none; align-items: center; gap: 2px; padding: 3px; background: #1C2B3A; border-radius: 8px; box-shadow: 0 6px 18px rgba(10,20,35,.3); z-index: 6; }
.foto-barra button { background: none; border: 0; color: #fff; height: 26px; min-width: 28px; padding: 0 4px; border-radius: 5px; font: 700 12px var(--ui); display: inline-grid; place-items: center; cursor: pointer; }
.foto-barra button:hover { background: rgba(255,255,255,.15); }
.foto-barra button.rojo { color: #FF8A8F; }
.foto-barra svg { width: 16px; height: 16px; }
.foto-barra i { width: 1px; height: 18px; background: rgba(255,255,255,.2); margin: 0 3px; }
.foto-caja.sel .foto-asa { display: block; }
.foto-caja.sel .foto-barra { display: flex; }
.ProseMirror .foto-caja.ProseMirror-selectednode { outline-color: var(--accion); }
.visor-foto { position: fixed; inset: 0; z-index: 80; background: rgba(8,12,18,.88); display: grid; place-items: center; cursor: zoom-out; padding: 16px; }
.visor-foto img { max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.pa-cont img.foto { width: 200px; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; max-width: 220px; border-radius: 4px; display: inline-block; vertical-align: top; margin: 4px 8px 4px 0; cursor: zoom-in; box-shadow: 0 0 0 1px rgba(28,43,58,.22); }
.t-caja { width: 20px; height: 20px; border: 2px solid var(--tinta-2); border-radius: 4px; margin: 0; padding: 0; cursor: pointer; display: grid; place-items: center; background: var(--hoja); color: #fff; }
.t-caja svg { width: 14px; height: 14px; }
.t-caja:hover { border-color: var(--terminado); }
li.terminado > .t-controles .t-caja { background: var(--t-caja-am); border-color: var(--t-caja-am); }
li.revisado > .t-controles .t-caja { background: var(--t-caja-vd); border-color: var(--t-caja-vd); }
.t-marca { grid-area: marca; justify-self: end; align-self: center; display: inline-flex; align-items: center; gap: 3px; margin-top: 3px; font-family: var(--mono); font-size: 10px; letter-spacing: .2px; white-space: nowrap; }
.t-marca svg { width: 11px; height: 11px; }
.t-marca.ia { color: #D97757; }
.t-marca.yo { color: #7A8F1E; }
:root[data-tema="oscuro"] .t-marca.yo { color: #A9C24A; }
.t-etiquetas { grid-area: chip; justify-self: start; display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.t-num { font-family: var(--mono); font-size: 10px; color: var(--tinta-2); opacity: .7; letter-spacing: .2px; }
.t-chip { justify-self: start; font-family: var(--ui); font-size: 9px; line-height: 14px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; border: 0; border-radius: 4px; padding: 0 5px; margin: 0; background: var(--pendiente-suave); color: var(--pendiente); cursor: pointer; }
.t-chip:hover:not(:disabled) { filter: brightness(.95); box-shadow: inset 0 0 0 1px currentColor; }
li.urgente > .t-controles .t-chip { background: var(--urgente); color: #fff; }
li.terminado > .t-controles .t-chip { background: var(--t-chip-am); color: var(--t-chip-am-txt); }
li.revisado > .t-controles .t-chip { background: var(--t-chip-vd); color: #fff; }
/* hecha = resaltado amarillo (por revisar); revisada = resaltado verde y tachada (lista para archivar) */
li.tarea.terminado { background: var(--t-amarillo); }
li.tarea.revisado { background: var(--t-verde); }
li.tarea.terminado:hover { background: var(--t-amarillo-2); }
li.tarea.revisado:hover { background: var(--t-verde-2); }
.t-contenido { flex: 1; min-width: 0; }
.t-fecha { flex: none; position: relative; background: none; border: 1px dashed transparent; border-radius: 12px; height: 24px; margin-top: 2px; padding: 0 6px; display: inline-flex; align-items: center; color: var(--tinta-2); opacity: 0; font-family: var(--mono); font-size: 12px; }
li.tarea:hover > .t-acciones .t-fecha, .t-fecha.con-fecha { opacity: 1; }
.t-fecha:hover { border-color: var(--regla); }
.t-fecha svg { width: 15px; height: 15px; }
.t-fecha.con-fecha { background: var(--accion-suave); color: var(--accion); }
.t-fecha.vencida { background: var(--urgente-suave); color: var(--urgente); }
li.hecha > .t-acciones .t-fecha.con-fecha { background: none; color: var(--tinta-2); }
.t-picker { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; bottom: 0; left: 0; border: 0; padding: 0; }
body.sin-hechas li.tarea.hecha { display: none; }

/* zoom compacto: solo el porcentaje; al pasar el mouse se despliega con − barra + */
.zoom { position: fixed; right: 18px; bottom: 14px; z-index: 25; display: flex; align-items: center; gap: 0; background: var(--cinta); border: 1px solid var(--regla); border-radius: 18px; padding: 3px 4px; box-shadow: var(--sombra); font-size: 12px; }
.zoom-btn, .zoom input { display: none; }
.zoom:hover, .zoom:focus-within { gap: 6px; padding: 4px 10px; }
.zoom:hover .zoom-btn, .zoom:focus-within .zoom-btn { display: inline-grid; place-items: center; }
.zoom:hover input, .zoom:focus-within input { display: block; }
.zoom-btn { background: none; border: 0; width: 24px; height: 24px; border-radius: 50%; font-size: 17px; line-height: 1; color: var(--tinta-2); }
.zoom-btn:hover { background: var(--accion-suave); color: var(--tinta); }
.zoom input { width: 110px; accent-color: var(--accion); }
.zoom-valor { background: none; border: 0; font-family: var(--mono); font-size: 11.5px; min-width: 42px; height: 24px; color: var(--tinta-2); border-radius: 12px; }
/* selector de fecha: misma familia visual que las hojas (papel blanco, azul de la marca) */
.sel-fecha { position: fixed; z-index: 65; width: 292px; background: #fff; color: #1C2B3A; border-radius: 12px; box-shadow: 0 12px 36px rgba(15,25,45,.28), 0 0 0 1px rgba(28,43,58,.08); padding: 14px; font-family: var(--ui); font-size: 13px; user-select: none; }
.sel-fecha button { font-family: var(--ui); border: 0; background: none; color: #1C2B3A; cursor: pointer; }
.sf-atajos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 12px; }
.sf-atajos button { background: #EEF1F7; border-radius: 7px; padding: 6px 0; font-size: 12px; font-weight: 600; color: #3346B8; }
.sf-atajos button:hover { background: #E0E5FA; }
.sf-mes { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sf-mes b { font-size: 14px; text-transform: capitalize; font-variation-settings: "wdth" 90; }
.sf-flecha { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #5B6B7B !important; }
.sf-flecha:hover { background: #EEF1F7 !important; }
.sf-flecha svg { width: 14px; height: 14px; }
.sf-semana, .sf-dias { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.sf-semana span { font-size: 10.5px; font-weight: 700; color: #8A97A6; padding: 2px 0 4px; }
.sf-dia { height: 32px; border-radius: 50%; font-size: 13px; font-variant-numeric: tabular-nums; }
.sf-dia:hover { background: #EEF1F7 !important; }
.sf-dia.pasado { color: #B4BEC9 !important; }
.sf-dia.hoy { box-shadow: inset 0 0 0 1.5px #3346B8; font-weight: 700; color: #3346B8 !important; }
.sf-dia.sel { background: #3346B8 !important; color: #fff !important; font-weight: 700; }
.sf-titulo { font-size: 10.5px; font-weight: 700; color: #8A97A6; text-transform: uppercase; letter-spacing: .8px; margin: 12px 0 6px; border-top: 1px solid #EDF0F4; padding-top: 10px; }
.sf-horas { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; }
.sf-minutos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin-top: 4px; }
.sf-horas button, .sf-minutos button { height: 28px; border-radius: 6px; font-size: 12.5px; font-variant-numeric: tabular-nums; background: #F5F7FA !important; }
.sf-horas button:hover, .sf-minutos button:hover { background: #E0E5FA !important; }
.sf-horas button.sel, .sf-minutos button.sel { background: #3346B8 !important; color: #fff !important; font-weight: 700; }
.sf-resumen { margin: 10px 0 12px; font-size: 12px; color: #5B6B7B; min-height: 1.3em; }
.sf-resumen::first-letter { text-transform: uppercase; }
.sf-acciones { display: flex; gap: 6px; align-items: center; }
.sf-quitar { margin-right: auto; color: #C2255C !important; font-size: 12.5px; padding: 6px 4px; }
.sf-quitar:hover { text-decoration: underline; }
.sf-cancelar { margin-left: auto; padding: 7px 10px; border-radius: 7px; font-size: 13px; color: #5B6B7B !important; }
.sf-cancelar:hover { background: #EEF1F7 !important; }
.sf-guardar { padding: 7px 16px; border-radius: 7px; font-size: 13px; font-weight: 700; background: #3346B8 !important; color: #fff !important; }
.sf-guardar:hover { background: #2A3A9C !important; }
.sf-guardar:disabled { opacity: .4; cursor: default; }
.burbuja { position: fixed; z-index: 55; display: flex; align-items: center; gap: 2px; padding: 4px; background: #1C2B3A; color: #fff; border-radius: 9px; box-shadow: 0 8px 24px rgba(10,20,35,.3); font-family: var(--ui); }
.burbuja button { background: none; border: 0; color: #fff; height: 30px; min-width: 30px; padding: 0 8px; border-radius: 6px; display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; }
.burbuja button:hover { background: rgba(255,255,255,.14); }
.burbuja svg { width: 17px; height: 17px; }
.burbuja .b-letra { font-family: var(--doc); font-size: 16px; padding: 0 6px; }
.burbuja .b-color { padding: 0 5px; }
.burbuja .b-color span { width: 16px; height: 16px; border-radius: 4px; display: block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.burbuja .b-sin { background: linear-gradient(135deg, #fff 45%, #E5484D 45%, #E5484D 55%, #fff 55%); }
@media (max-width: 560px) { .burbuja:not(.mini) button span { display: none; } .burbuja button { min-width: 36px; height: 34px; } }
.burbuja .b-rojo { color: #FF8A8F; }
.burbuja .b-sep { width: 1px; height: 20px; background: rgba(255,255,255,.2); margin: 0 3px; }
.burbuja.mini { padding: 2px; gap: 1px; background: #fff; border-radius: 7px; box-shadow: 0 1px 4px rgba(28,43,58,.16), 0 0 0 1px rgba(28,43,58,.08); }
.burbuja.mini button { height: 24px; min-width: 24px; padding: 0 4px; color: #8A97A6; }
.burbuja.mini button:hover { background: #EEF1F7; color: #3346B8; }
.burbuja.mini button span { display: none; }
.burbuja.mini svg { width: 15px; height: 15px; }
.toast { display: flex; align-items: center; gap: 14px; pointer-events: auto; }
#toastAccion { background: none; border: 0; color: #9DB0FF; font-weight: 700; padding: 2px 4px; text-transform: uppercase; font-size: 13px; letter-spacing: .4px; }
@media (prefers-color-scheme: dark) { #toastAccion { color: var(--accion); } }
.btn-archivo { display: flex; align-items: center; gap: 8px; width: 100%; background: var(--hoja); border: 1px solid var(--regla); border-radius: 8px; padding: 7px 10px; margin: 2px 0 12px; font-size: 14px; }
.btn-archivo:hover { border-color: var(--accion); }
.cuenta-archivo { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--tinta-2); }
.mini-menu hr, .menu-flotante hr { border: 0; border-top: 1px solid var(--regla); margin: 4px 0; }
.panel-archivo { position: fixed; inset: 0; z-index: 60; }
.pa-fondo { position: absolute; inset: 0; background: rgba(10,16,24,.45); }
.pa-caja { position: absolute; top: 0; right: 0; bottom: 0; width: min(620px, 100%); background: var(--papel); display: flex; flex-direction: column; box-shadow: -10px 0 30px rgba(0,0,0,.25); }
.pa-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 10px; }
.pa-cab h2 { margin: 0; font-size: 20px; }
.pa-sub { margin: 4px 0 0; font-size: 13px; color: var(--tinta-2); }
.pa-filtros { display: flex; gap: 8px; padding: 0 20px 12px; }
.pa-filtros .h-sel { flex: 1; min-width: 0; }
.pa-buscar { flex: 1; min-width: 0; height: 32px; border: 1px solid var(--regla); border-radius: 5px; background: var(--hoja); color: var(--tinta); padding: 0 10px; font: inherit; font-size: 14px; }
.pa-lista { flex: 1; overflow-y: auto; padding: 0 20px 40px; }
.pa-vacio { text-align: center; color: var(--tinta-2); margin-top: 60px; line-height: 1.6; }
.pa-dia { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--tinta-2); margin: 18px 0 8px; }
.pa-dia::first-letter { text-transform: uppercase; }
.pa-item { background: #fff; color: #1C2B3A; border-radius: 6px; box-shadow: var(--sombra); padding: 10px 16px 12px; margin-bottom: 10px; }
.pa-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: #5B6B7B; margin-bottom: 4px; }
.pa-proy { font-weight: 700; }
.pa-restaurar { margin-left: auto; background: none; border: 1px solid #D3DBE3; border-radius: 6px; padding: 4px 10px; font-size: 12px; color: #3346B8; }
.pa-restaurar:hover { background: #E3E7FA; border-color: #3346B8; }
.pa-cont { font-family: var(--doc); font-size: 15px; line-height: 1.45; }
.pa-cont p { margin: 0 0 3px; text-align: justify; }
.pa-cont ul[data-type="taskList"] { list-style: none; padding-left: 0; margin: 0; }
.pa-cont li[data-type="taskItem"] { display: flex; gap: 8px; align-items: flex-start; }
.pa-cont li[data-type="taskItem"] > label { padding-top: 3px; }
.pa-cont li[data-checked="true"] { background: #FFF5C4; border-radius: 4px; }
.pa-cont li[data-revisado="true"] { background: #D7F5E1; }
.pa-cont mark { border-radius: 2px; padding: 0 1px; color: inherit; }
.toast { position: fixed; z-index: 70; bottom: 22px; left: 50%; transform: translate(-50%, 30px); background: var(--tinta); color: var(--hoja); padding: 10px 18px; border-radius: 8px; font-size: 14px; opacity: 0; transition: .2s; pointer-events: none; z-index: 70; max-width: calc(100% - 32px); }
.toast.ver { pointer-events: auto; opacity: 1; transform: translate(-50%, 0); }

/* ---- celular ---- */
@media (max-width: 820px) {
  .solo-movil { display: inline-flex; }
  /* la cabecera deja libre la franja de la hora y del «volver» de iOS, y el botón de proyectos es grande para no fallar el toque */
  .cinta { padding-top: env(safe-area-inset-top); }
  .cinta-fila1 { padding: 8px 12px 6px 14px; }
  #btnMenu { width: 48px; min-width: 48px; height: 44px; border: 1px solid var(--regla); border-radius: 10px; background: var(--hoja); color: var(--tinta); margin-right: 2px; }
  #btnMenu svg { width: 24px; height: 24px; }
  #btnMenu:active { background: var(--accion-suave); }
  .cuerpo { grid-template-columns: 1fr; }
  .lateral { position: fixed; inset: 0 auto 0 0; width: 82%; max-width: 300px; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--sombra); }
  body.menu-abierto .lateral { transform: none; }
  .lateral { padding-top: calc(14px + env(safe-area-inset-top)); padding-bottom: calc(30px + env(safe-area-inset-bottom)); }
  .herramientas { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  /* los controles van pegados a la derecha, lejos del botón de proyectos (si no caben, se deslizan como antes) */
  .herramientas > :first-child { margin-left: auto; }
  .grupo { flex: none; }
  .h-btn.txt span { display: none; }
  .hojas { padding: 12px 8px 100px; }
  .hoja { width: auto; }
  .hoja-cab { padding: 12px 12px 4px 6px; }
  .hoja-cuenta { display: none; }
  .btn-claude span { display: none; }
  .hoja-doc { padding: 4px 16px 24px; }
  .t-fecha, .t-foto { opacity: 1; }
  .agarre { opacity: .7; width: 22px; }
  .ng-mas { opacity: .8; width: 30px; height: 26px; }
  .nav li.ng-cab { font-size: 11.5px; padding-top: 6px; padding-bottom: 6px; }
  .zoom { right: 10px; bottom: 10px; }
  .chat-flotante { right: 10px; bottom: 54px; }
  .zoom input { width: 70px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
