:root {
  /* Colores por módulo */
  --azul: #2563eb;
  --naranja: #ea7a17;
  --verde: #16a34a;
  --morado: #7c3aed;
  --rosa: #db2777;

  --fondo: #f6f7f9;
  --superficie: #ffffff;
  --texto: #14161a;
  --texto-2: #5b616e;
  --texto-3: #8a909c;
  --borde: #e6e8ec;
  --peligro: #dc2626;

  --radio: 16px;
  --sombra: 0 1px 2px rgb(16 24 40 / 0.04), 0 1px 3px rgb(16 24 40 / 0.06);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--texto);
  background: var(--fondo);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
h1, h2, p { margin: 0; }
button { font: inherit; color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.9em; background: #eef0f3; padding: 1px 6px; border-radius: 6px; }
[hidden] { display: none !important; }

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 20px max(32px, env(safe-area-inset-bottom));
}
.vista { display: flex; flex-direction: column; gap: 16px; }
.centro { min-height: 80dvh; display: grid; place-content: center; justify-items: center; text-align: center; gap: 12px; }

/* ---------- Botones ---------- */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 48px; padding: 0 22px; border-radius: 12px; border: 0;
  font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 150ms ease, box-shadow 150ms ease;
}
.boton:active { transform: scale(0.97); }
.boton-primario { background: var(--texto); color: #fff; }
.boton-secundario { background: var(--superficie); color: var(--texto); box-shadow: inset 0 0 0 1px var(--borde); }
@media (hover: hover) and (pointer: fine) {
  .boton-primario:hover { background: #2a2e36; }
  .boton-secundario:hover { background: #f1f2f4; }
}
:focus-visible { outline: 2px solid var(--azul); outline-offset: 2px; }

/* ---------- Bienvenida ---------- */
.bienvenida .logo { border-radius: 18px; box-shadow: var(--sombra); margin-bottom: 8px; }
.bienvenida h1 { font-size: 28px; letter-spacing: -0.02em; }
.sub { color: var(--texto-2); margin-bottom: 12px; }
.nota { color: var(--texto-3); font-size: 13px; }

.tarjeta {
  background: var(--superficie); border-radius: var(--radio); box-shadow: var(--sombra);
  padding: 18px;
}
.tarjeta-aviso { max-width: 440px; min-height: auto; margin: 15dvh auto 0; gap: 14px; padding: 28px; }
.tarjeta-aviso h1 { font-size: 20px; }
.tarjeta-aviso p { color: var(--texto-2); line-height: 1.5; }

/* ---------- Encabezado ---------- */
.encabezado { display: flex; justify-content: space-between; align-items: flex-start; padding-top: 8px; }
.fecha { color: var(--texto-3); font-size: 13px; font-weight: 500; }
.encabezado h1 { font-size: 26px; letter-spacing: -0.02em; margin-top: 2px; }

.menu-contenedor { position: relative; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--texto); color: #fff; font-weight: 600; font-size: 14px;
  transition: transform 160ms var(--ease-out);
}
.avatar:active { transform: scale(0.95); }
.menu {
  position: absolute; right: 0; top: 48px; z-index: 10; min-width: 220px;
  background: var(--superficie); border-radius: 14px; padding: 6px;
  box-shadow: 0 8px 30px rgb(16 24 40 / 0.12), 0 0 0 1px var(--borde);
  transform-origin: top right;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}
@starting-style { .menu { opacity: 0; transform: scale(0.96); } }
.menu-correo { font-size: 12px; color: var(--texto-3); padding: 8px 10px 6px; overflow: hidden; text-overflow: ellipsis; }
.menu button {
  display: block; width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
  padding: 10px; border-radius: 8px; font-size: 14px;
}
.menu button.peligro { color: var(--peligro); }
@media (hover: hover) and (pointer: fine) { .menu button:hover { background: #f3f4f6; } }

/* ---------- Banners ---------- */
.banner-demo, .banner-offline { font-size: 13px; padding: 10px 14px; border-radius: 12px; }
.banner-demo { background: #f3e8ff; color: #5b21b6; }
.banner-offline { background: #fff4e5; color: #9a4a06; }

/* ---------- Estado OneDrive ---------- */
.estado-fila { display: flex; gap: 12px; align-items: center; }
.estado-icono {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--azul) 12%, white); color: var(--azul);
}
.estado h2 { font-size: 15px; }
.estado p { font-size: 13px; color: var(--texto-2); margin-top: 2px; }
.estado[data-estado="ok"] .estado-icono { background: color-mix(in srgb, var(--verde) 12%, white); color: var(--verde); }
.estado[data-estado="error"] .estado-icono { background: #fee2e2; color: var(--peligro); }
.progreso { height: 6px; border-radius: 99px; background: #eef0f3; margin-top: 14px; overflow: hidden; }
.progreso-barra {
  height: 100%; width: 100%; background: var(--azul); border-radius: inherit;
  transform-origin: left; transform: scaleX(0);
  transition: transform 200ms var(--ease-out);
}

.seccion-titulo { font-size: 13px; font-weight: 600; color: var(--texto-3); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 8px; }

/* ---------- Spinner ---------- */
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid #e3e5e9; border-top-color: var(--texto);
  animation: girar 600ms linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 50; width: min(92vw, 380px); pointer-events: none;
}
.toast {
  background: var(--texto); color: #fff; font-size: 14px; padding: 12px 16px; border-radius: 12px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
  transition: opacity 250ms ease, transform 250ms var(--ease-out);
}
@starting-style { .toast { opacity: 0; transform: translateY(100%); } }
.toast.saliendo { opacity: 0; transform: translateY(8px); transition-duration: 160ms; }

@media (prefers-reduced-motion: reduce) {
  .toast, .menu { transition: opacity 200ms ease; }
  @starting-style { .toast, .menu { transform: none; } }
  @keyframes aparecer { from { opacity: 0; } }
}

/* ---------- Cascada (menús de izquierda a derecha) ---------- */
.cascada {
  display: flex; gap: 12px; align-items: flex-start;
  overflow-x: auto; scroll-snap-type: x proximity; overscroll-behavior-x: contain;
  padding: 2px 2px 8px; margin: 0 -2px;
  scrollbar-width: thin;
}
.columna {
  --c: var(--texto);
  flex: 0 0 248px; scroll-snap-align: end;
  background: var(--superficie); border-radius: var(--radio); box-shadow: var(--sombra);
  padding: 10px; display: flex; flex-direction: column; gap: 2px;
}
.columna[data-color="azul"] { --c: var(--azul); }
.columna[data-color="gris"] { --c: #4b5563; }
/* La columna nueva entra desde la derecha; al regresar, desde la izquierda. */
.columna.entra { animation: col-entra 220ms var(--ease-out) both; }
.columna.entra-atras { animation: col-entra-atras 200ms var(--ease-out) both; }
@keyframes col-entra { from { opacity: 0; transform: translateX(16px); } }
@keyframes col-entra-atras { from { opacity: 0; transform: translateX(-16px); } }

.col-cabecera { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 4px 6px 8px; }
.col-cabecera h3 { margin: 0; width: 100%; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.col-ruta { font-size: 12px; color: var(--texto-3); min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-atras {
  width: 30px; height: 30px; border-radius: 8px; border: 0; background: #f1f2f4; cursor: pointer;
  display: grid; place-items: center; color: var(--texto);
  transition: transform 140ms var(--ease-out);
}
.col-atras:active { transform: scale(0.94); }
.col-cuerpo { display: flex; flex-direction: column; gap: 2px; }
.col-seccion { font-size: 11.5px; font-weight: 600; color: var(--texto-3); text-transform: uppercase; letter-spacing: 0.06em; padding: 12px 8px 4px; }
.col-vacio, .col-nota { font-size: 12.5px; color: var(--texto-3); padding: 6px 8px; line-height: 1.45; }

.opcion {
  --c2: var(--c);
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 0; background: none; cursor: pointer; border-radius: 10px; padding: 9px 8px; min-height: 44px;
  transition: transform 140ms var(--ease-out), background-color 150ms ease, color 150ms ease;
}
.opcion:active { transform: scale(0.98); }
.opcion[data-color="azul"] { --c2: var(--azul); }
.opcion[data-color="verde"] { --c2: var(--verde); }
.opcion[data-color="naranja"] { --c2: var(--naranja); }
.opcion[data-color="gris"] { --c2: #4b5563; }
.opcion-icono {
  width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c2) 12%, white); color: var(--c2);
}
.opcion-texto { display: flex; flex-direction: column; min-width: 0; flex: 1; font-size: 14px; font-weight: 500; }
.opcion-texto small { font-size: 12px; font-weight: 400; color: var(--texto-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opcion .chevron { color: var(--texto-3); flex: none; transition: transform 150ms var(--ease-out); }
.opcion .insignia { font-size: 11px; font-weight: 600; color: var(--texto-3); background: #f1f2f4; padding: 3px 8px; border-radius: 99px; flex: none; }
.opcion.sutil .opcion-texto { color: var(--texto-2); }
.opcion.sutil .opcion-icono { background: #f1f2f4; color: var(--texto-2); }
.opcion.elegido { background: color-mix(in srgb, var(--c2) 10%, white); color: color-mix(in srgb, var(--c2) 80%, black); }
.opcion.elegido .chevron { color: var(--c2); transform: translateX(2px); }
@media (hover: hover) and (pointer: fine) {
  .opcion:hover:not(.elegido) { background: #f5f6f8; }
}

.unidades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 2px; }
.opcion.unidad { justify-content: center; font-weight: 600; background: #f5f6f8; }
.opcion.unidad.sugerida { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 45%, transparent); }
.opcion.unidad.elegido { background: var(--c); color: #fff; }

/* Formularios dentro de columnas */
.columna:has(.campo), .columna:has(.zona-archivo) { flex-basis: 300px; }
.destino { display: flex; flex-direction: column; gap: 2px; padding: 0 6px 6px; font-size: 13px; font-weight: 600; color: var(--c); }
.destino small { font-weight: 400; color: var(--texto-3); font-size: 11.5px; word-break: break-all; }
.campo { display: flex; flex-direction: column; gap: 6px; padding: 6px; font-size: 13px; color: var(--texto-2); }
.campo input {
  height: 42px; border-radius: 10px; border: 1px solid var(--borde); padding: 0 12px; font: inherit; font-size: 15px; color: var(--texto);
  background: #fbfbfc; transition: border-color 150ms ease, box-shadow 150ms ease;
}
.campo input:focus { outline: none; border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); background: #fff; }
.ayuda { font-size: 12px; color: var(--texto-3); }
.ayuda b { color: var(--texto-2); }
.error { font-size: 12.5px; color: var(--peligro); padding: 0 6px; }

.zona-archivo {
  margin: 6px; border-radius: 12px; border: 1.5px dashed #d5d8de; padding: 16px 12px; cursor: pointer;
  display: grid; place-items: center; text-align: center; color: var(--texto-2); font-size: 14px;
  transition: transform 140ms var(--ease-out), border-color 150ms ease, background-color 150ms ease;
}
.zona-archivo:active { transform: scale(0.98); }
.zona-archivo.con-archivo { border-style: solid; border-color: color-mix(in srgb, var(--c) 40%, white); background: color-mix(in srgb, var(--c) 5%, white); color: var(--texto); }
.zona-texto { display: flex; align-items: center; gap: 8px; min-width: 0; }
.zona-texto span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
@media (hover: hover) and (pointer: fine) { .zona-archivo:hover { border-color: var(--c); } }

.vista-previa { list-style: none; margin: 0; padding: 0 6px; display: flex; flex-direction: column; gap: 6px; }
.vista-previa li { background: #f6f7f9; border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; position: relative; overflow: hidden; }
.nombre-final { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; color: var(--texto); word-break: break-all; }
.vista-previa small { font-size: 11.5px; color: var(--texto-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; }
.barra span { display: block; height: 100%; background: var(--c); transform-origin: left; transform: scaleX(0); transition: transform 200ms var(--ease-out); }
.vista-previa li.listo .barra span { background: var(--verde); }

.columna .boton { margin: 8px 6px 2px; }
.boton-chico { height: 36px; padding: 0 12px; font-size: 13px; margin: 0 !important; gap: 6px; }
.boton:disabled { opacity: 0.6; cursor: default; transform: none; }

.resultado {
  margin: 8px 6px 2px; padding: 12px; border-radius: 12px; display: flex; flex-direction: column; gap: 6px;
  background: color-mix(in srgb, var(--verde) 8%, white); font-size: 13px;
  animation: entrar 240ms var(--ease-out) both;
}
.resultado strong { color: #15803d; }
.resultado a { color: var(--azul); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; word-break: break-all; text-decoration: none; }
.resultado-acciones { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
@keyframes entrar { from { opacity: 0; transform: translateY(6px); } }

/* Listas de Configurar */
.lista-config { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.lista-config li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 8px; border-radius: 10px; }
.lista-config li + li { border-top: 1px solid #f0f1f3; }
.lista-config li > span { display: flex; flex-direction: column; min-width: 0; font-size: 14px; font-weight: 500; }
.lista-config small { font-size: 12px; font-weight: 400; color: var(--texto-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-config li.archivada > span { color: var(--texto-3); text-decoration: line-through; text-decoration-color: #c9ccd2; }
.boton-texto {
  border: 0; background: none; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--azul);
  padding: 6px 8px; border-radius: 8px; flex: none; transition: transform 140ms var(--ease-out), background-color 150ms ease;
}
.boton-texto:active { transform: scale(0.96); }
.boton-texto.peligro { color: var(--peligro); }
@media (hover: hover) and (pointer: fine) { .boton-texto:hover { background: #f3f4f6; } }

.cascada-error { color: var(--texto-2); font-size: 14px; padding: 12px; }

/* Celular: una columna a la vez, a todo lo ancho */
.cascada.cascada-movil { overflow: visible; display: block; margin: 0; padding: 0; }
.cascada.cascada-movil .columna { width: 100%; }

/* ---------- Hoy ---------- */
.hoy-lista { list-style: none; margin: 0; padding: 4px; background: var(--superficie); border-radius: var(--radio); box-shadow: var(--sombra); }
.hoy-lista li { display: flex; gap: 12px; align-items: baseline; padding: 10px 12px; font-size: 13.5px; }
.hoy-lista li + li { border-top: 1px solid #f0f1f3; }
.hoy-lista time { color: var(--texto-3); font-size: 12px; font-variant-numeric: tabular-nums; flex: none; width: 40px; }
.hoy-texto { display: flex; flex-direction: column; min-width: 0; }
.hoy-texto a { color: var(--texto); text-decoration: none; word-break: break-all; }
.hoy-texto small { color: var(--texto-3); font-size: 12px; }
@media (hover: hover) and (pointer: fine) { .hoy-texto a:hover { color: var(--azul); } }
.hoy-vacio { color: var(--texto-3); }

@media (prefers-reduced-motion: reduce) {
  .columna.entra, .columna.entra-atras, .resultado { animation: aparecer 180ms ease both; }
  @keyframes aparecer { from { opacity: 0; } }
}

/* ---------- Estilo "liquid glass" ---------- */
:root {
  --vidrio: rgb(255 255 255 / 0.55);
  --vidrio-fuerte: rgb(255 255 255 / 0.75);
  --vidrio-borde: inset 0 1px 0 rgb(255 255 255 / 0.9), inset 0 0 0 1px rgb(255 255 255 / 0.6);
  --vidrio-sombra: 0 8px 32px rgb(30 41 80 / 0.08);
  background:
    radial-gradient(40vw 40vw at 8% 12%, rgb(37 99 235 / 0.22), transparent 70%),
    radial-gradient(35vw 35vw at 92% 8%, rgb(234 122 23 / 0.18), transparent 70%),
    radial-gradient(40vw 40vw at 85% 85%, rgb(124 58 237 / 0.18), transparent 70%),
    radial-gradient(35vw 35vw at 15% 90%, rgb(22 163 74 / 0.16), transparent 70%),
    #eef1f6;
  background-attachment: fixed;
}
body { background: transparent; }

.tarjeta, .columna, .hoy-lista, .menu {
  background: var(--vidrio);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: var(--vidrio-borde), var(--vidrio-sombra);
}
.opcion.elegido { background: var(--vidrio-fuerte); box-shadow: inset 0 1px 0 #fff, 0 2px 8px rgb(30 41 80 / 0.08); }
.opcion-icono, .estado-icono { background: rgb(255 255 255 / 0.7); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.8); }
.opcion .insignia, .col-atras, .opcion.unidad { background: rgb(255 255 255 / 0.6); }
.opcion.unidad.elegido { background: var(--c); }
.campo input { background: rgb(255 255 255 / 0.6); border-color: rgb(255 255 255 / 0.9); }
.campo input:focus { background: rgb(255 255 255 / 0.9); }
.vista-previa li { background: rgb(255 255 255 / 0.55); }
.zona-archivo { border-color: rgb(120 130 150 / 0.35); }
.lista-config li + li, .hoy-lista li + li { border-top-color: rgb(255 255 255 / 0.7); }
@media (hover: hover) and (pointer: fine) {
  .opcion:hover:not(.elegido) { background: rgb(255 255 255 / 0.45); }
  .menu button:hover, .boton-texto:hover { background: rgb(255 255 255 / 0.6); }
}
.boton-primario, .avatar, .toast {
  background: rgb(20 22 26 / 0.82);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.boton-secundario { background: var(--vidrio-fuerte); box-shadow: var(--vidrio-borde); }
.banner-demo { background: rgb(243 232 255 / 0.6); }
.banner-offline { background: rgb(255 244 229 / 0.7); }

/* Navegadores sin desenfoque, o personas que piden menos transparencia: fondo sólido. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .tarjeta, .columna, .hoy-lista, .menu { background: rgb(255 255 255 / 0.92); }
}
@media (prefers-reduced-transparency: reduce) {
  .tarjeta, .columna, .hoy-lista, .menu { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
